|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-07-19 15:15 UTC] borreo at softhome dot net
[2005-02-11 15:24 UTC] tony2001@php.net
[2005-02-17 12:03 UTC] borreo at softhome dot net
[2005-02-17 12:59 UTC] borreo at softhome dot net
[2005-02-17 13:03 UTC] borreo at softhome dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 10:00:01 2025 UTC |
Description: ------------ Not really a bug, the code works. The stat function, if used on a network file, is much slower in PHP5 than in PHP 4.3.7. On my system, PHP 5.0 takes 20 seconds to stat 1000 files. With PHP 4.3.7, this takes 2 seconds. If I use a local directory (e.g. C:\work) rather than a network drive, then there is no visible difference in performance between PHP 4.3.7 and PHP 5. In order to produce accurate tests, I installed both version of PHP on the same machine, in different directories, using a common php.ini Reproduce code: --------------- // I: points to a network drive chdir( 'I:/work' ) ; $ListOfFiles = rglob( ".", "*" ) ; $StartTime = time() ; foreach( $ListOfFiles as $i ) stat( $i ) ; $ElapsedTime = time() - $StartTime ; die( "Seconds=$ElapsedTime\n" ); // Recursive version of glob function rglob( $Dir, $Pattern ) { $Files = glob( "$Dir/$Pattern", 0 ) ; $Directories = glob( "$Dir/*", GLOB_ONLYDIR ) ; if ( is_array( $Directories ) ) { foreach( $Directories as $SubDir ) { $SubFiles = rglob( $SubDir, $Pattern ) ; if ( is_array( $SubFiles ) ) $Files = array_merge( $Files, $SubFiles ) ; } } return $Files; } Actual result: -------------- With PHP 5.0: Seconds=20 With PHP 4.3.7: Seconds=2 If I change the current directory to a local dir (e.g. C:\work) then there is no difference between PHP 4.3.7 and PHP 5.0: With PHP 5.0: Seconds=2 With PHP 4.3.7: Seconds=2