ID: 40970 Updated by: [EMAIL PROTECTED] Reported By: php at edwardk dot info -Status: Open +Status: Bogus Bug Type: Performance problem Operating System: Windows 2003 PHP Version: 5.2.1 New Comment:
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. Previous Comments: ------------------------------------------------------------------------ [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