#22721 [Opn->Asn]: _php_stream_copy_to_mem performance sucks on systems without mmap support

From: Date: Tue, 18 Mar 2003 13:56:39 +0000
Subject: #22721 [Opn->Asn]: _php_stream_copy_to_mem performance sucks on systems without mmap support
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-35813@lists.php.net to get a copy of this message
ID: 22721 Updated by: wez@php.net -Summary: upgrade from 4.2.2 to 4.3.1 file() takes 10 x longer Reported By: shawn at rumental dot com -Status: Open +Status: Assigned Bug Type: Performance problem Operating System: win2k PHP Version: 4.3.1 -Assigned To: +Assigned To: wez New Comment: Too many reallocs makes for a slow file() implementation. PHP5 will have much better performance here under windows with the new memory mapping support (and will actually have *faster* performance). I am working on a fix for 4.3.x now. Previous Comments: ------------------------------------------------------------------------ [2003-03-18 06:53:56] shawn at rumental dot com typo - "USING 4.3.1 should be USING 4.2.2" my bad ------------------------------------------------------------------------ [2003-03-17 22:11:57] shawn at rumental dot com 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 ------------------------------------------------------------------------ [2003-03-17 09:45:43] sniper@php.net 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. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/22721 -- Edit this bug report at http://bugs.php.net/?id=22721&edit=1

« previous php.bugs (#35813) next »