ID: 22721 User updated by: shawn at rumental dot com Reported By: shawn at rumental dot com -Status: Feedback +Status: Open Bug Type: Performance problem Operating System: win2k PHP Version: 4.3.1 New Comment:
EXAMPLE CODE ------------------------------------------- set_time_limit ('200'); # logfile is 4mb text file with 17370 LINES $file="test.log"; $times=10; $i=1; while($i <=$times){ $mt = explode(' ', microtime()); $script_start_time = $mt[0] + $mt[1]; file($file); $mt = explode(' ', microtime()); $script_end_time = $mt[0] + $mt[1]; $time[]=round($script_end_time - $script_start_time, 5); echo 'file loaded in ', round($script_end_time - $script_start_time, 5), ' seconds<br>'; $i++; } $average=array_sum($time)/$times; echo "average time - ".$average; --------------------------------------------------- RESULTS: USING 4.3.1 ------------ file loaded in 0.47855 seconds file loaded in 0.74892 seconds file loaded in 0.7595 seconds file loaded in 0.58205 seconds file loaded in 0.82617 seconds file loaded in 0.83293 seconds file loaded in 0.86725 seconds file loaded in 0.90333 seconds file loaded in 0.63803 seconds file loaded in 0.82538 seconds average time - 0.746211 LATEST STABLE -------------- file loaded in 16.18174 seconds file loaded in 16.88304 seconds file loaded in 16.68356 seconds file loaded in 16.49004 seconds file loaded in 16.42378 seconds file loaded in 16.5862 seconds file loaded in 16.80012 seconds file loaded in 16.13519 seconds file loaded in 25.35214 seconds file loaded in 32.71799 seconds average time - 19.02538 results are similar even with smaller files Previous Comments: ------------------------------------------------------------------------ [2003-03-17 09:45:43] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip Also, add a short but complete example script here which can be used to reprodude this problem. ------------------------------------------------------------------------ [2003-03-17 08:32:46] shawn at rumental dot com changed summary - reopened ------------------------------------------------------------------------ [2003-03-17 08:31:35] shawn at rumental dot com in version 4.3.1 file() seems to be extremly slow 10-100x as slow. a serious performance issue. http://bugs.php.net/bug.php?id=19971 also refers to this problem but has been closed with incorrect information it seems. ------------------------------------------------------------------------ [2003-03-15 01:30:46] shawn at rumental dot com RETRACTION - problem seems to have to do with file() and size of the file being read. sorry for inconveinence on my stupidities part. will further research and post new report if necessary. ------------------------------------------------------------------------ [2003-03-15 00:38:12] shawn at rumental dot com I just upgraded from 4.2.2 to 4.3.1(zip) in win2k. apache - isapi I replaced the ini file with newer one. most scipts i have run fine if not faster. I have a couple scripts which call preg-replace()on 15 key pattern match/replace array, each array match occuring at most 10 times per line of a text file. testing with a foreach(5 lines). (parsing text files to reformat). These scripts take 10-20 x longer to execute on 4.3.1 i can switch back to 4.2.2 and execution time is back to normal(2 seconds). tried with new and old ini. no errors are reported other than max execution time when its not set high enough. futher debugging is possible upon request, I dont know how at this point. php_info() snapshots, ini's, code are available. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22721&edit=1