ID: 40970 Updated by: [EMAIL PROTECTED] Reported By: php at edwardk dot info Status: Bogus Bug Type: Performance problem Operating System: Windows 2003 PHP Version: 5.2.1 New Comment:
Might be related to stat cache usage... Try to see if you see the difference stat'ing a set of files in random order, not the same file repeatedly. Previous Comments: ------------------------------------------------------------------------ [2007-04-01 20:42:47] php at edwardk dot info I have modified the code to use, $blah = stat('.htaccess'); This file does exist, it is 161 bytes on NTFS. PHP 4.4.6: 1.641ms PHP 5.1.2: 108.29ms Normally, I would be using the commands on many small files (400ish) in the current folder to determine if any of them had changed. This was fast enough on PHP4, but on PHP5, the same code takes much longer. ------------------------------------------------------------------------ [2007-04-01 14:44:02] [EMAIL PROTECTED] This is only the case when stat() fails. If you change stat('.'); to stat('<some file>'); you will se that PHP5 is faster than php4. Almost 2x. ------------------------------------------------------------------------ [2007-04-01 00:16:16] php at edwardk dot info Description: ------------ filemtime and other related functions are slower on php5 vs php4 Using PHP 5.2.1 and PHP 4.4.6 on Athlon X2 3800+, Windows 2003 the speed difference is about 50-100x slower. Reproduce code: --------------- <? header('Content-type: text/plain'); function microtime_float() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } $time_start = microtime_float(); for ($i = 1; $i <= 1000; $i++) { $blah = stat('.'); } $time_end = microtime_float(); $time = $time_end - $time_start; echo 'Took '.round(($time*100),3).'ms'; ?> Expected result: ---------------- Speeds should be similar Actual result: -------------- On PHP 4.4.6, it took about 1.6ms On PHP 5.2.1 it took about 130ms ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40970&edit=1