From: mike at schreiber dot com
Operating system: Solaris 6-10beta
PHP version: Irrelevant
PHP Bug Type: Performance problem
Bug description: Filling an array with php on Solaris is really slow.
Description:
------------
While filling an array with about 400.000 Elements on a solaris box took
several seconds to be done. On other OS or for example Java und Sun took
only a few mill-seconds.
The debugger reports, that php ist trying to fetch memory for every
element in the array. This is the reason why it get so slow.
I have tried different Solaris Versions and different php versions. It is
the compination of solaris and php.
Linux und Solaris (same hardware) is much more faster.
Reproduce code:
---------------
<?php
function GetMicrotime(){
list($microseconds, $seconds) = explode(" ",microtime());
return ((float)$microseconds + (float)$seconds);
}
$start = GetMicrotime();
$ende = GetMicrotime();
for($i=0;$i<50000;$i++)
{
$great_dump[] = array(1234,1234,1234);
}
$ende = GetMicrotime();
$time = $ende - $start;
printf("%.10f",$time);
echo "\n";
echo sizeof($great_dump);
?>
Expected result:
----------------
less then one second
Actual result:
--------------
took me about 6,3 seconds
Debugger:
0.1541 brk(0x003EC3A8) = 0
0.1542 brk(0x003EC3A8) = 0
0.1543 brk(0x003EE3A8) = 0
0.1544 brk(0x003EE3A8) = 0
0.1545 brk(0x003F03A8) = 0
0.1546 brk(0x003F03A8) = 0
0.1547 brk(0x003F23A8) = 0
0.1548 brk(0x003F23A8) = 0
0.1549 brk(0x003F43A8) = 0
0.1550 brk(0x003F43A8) = 0
0.1551 brk(0x003F63A8) = 0
continues about 3500 times
--
Edit bug report at http://bugs.php.net/?id=27126&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27126&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27126&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27126&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27126&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27126&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27126&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27126&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27126&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27126&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27126&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27126&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27126&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27126&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27126&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27126&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27126&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27126&r=float