Wouter van Vliet wrote:
Howdy,

I've written some, kinda coolish, class that reads directories
recursively with some simple calls. Yihaaa, .. (but I'm not the only
one who has done that, I guess :P). Anyway, during the process of
traversing a directory it checks to see if the "something" that was
found is either a directory or a file, based on that it will do some
things. Fine, works.

But, now that I've got a directory with about 800 files to read I
noticed that it takes the poor script almost two seconds to find the
correct type of all the "somethings". In fact, I timed it on a steady
1.71.

I've tried to use filetype() on the "something", but that took even
longer - while looping through the directory without any checks
finishes in 0.01 seconds.

Now, for the question: does anybody know an alternative method on
checking whether a "something" is either file or directory?

Wouter

(this time, I'm on a Windows XP machine running PHP5 - just tested the
same thing on Linux and PHP 4.3.8 and came out on 0.63 secs, ..)

Depends on the filesystem. There are not many alternatives in WXP, but FAT should be faster.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to