From:             eagle at shattered-reality dot de
Operating system: WinNT4-SP6a
PHP version:      4.3.4
PHP Bug Type:     Performance problem
Bug description:  terrible performance doing array-index-access

Description:
------------
I encountered some serious performance problems on our server (2x 2.8 Xeon
/ 2gb ram / WinNT4-SP6) using scripts that had run very well on my small
office workstation (Athlon 2400+ / 512gb ram / Win2k). 

I did some benchmarking (using scripts from
http://www.sebastian-bergmann.de/PHP_Benchmark/ ) using cmdline php.exe on
the server and found out that the "Array Index Access" test gives terrible
results (around 10.000 accesses/s compared to around 745.000/s on my
workstation). All other tests behaved as expected, so I don't think it is
a configuration problem.

I tried different versions of php.ini (including php.ini-dist) and various
versions of php itself (up to 5.0.0b1 / can't try 5.0.0b3 because of the
getlongpathname bug). 
This beaviour started in 4.1.0 while everything runs fine under 4.0.6.

I don't have a second box with a similar setup, so I can't test other OS,
but I have failed to reproduce this on any single-cpu system (Intel/Amd)
running various OS (WinNT/Win2k/WinXP). 

Reproduce code:
---------------
$N = 1000000;
$table = array();
$start = getMicrotime();
for ($i = 0; $i < $N; $i++) {
    $table[$i] = $i;
}
for ($i = 0; $i < $N; $i++) {
    $i = $table[$i];
}
$end = getMicrotime();



-- 
Edit bug report at http://bugs.php.net/?id=26800&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=26800&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=26800&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=26800&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=26800&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=26800&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=26800&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=26800&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=26800&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=26800&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=26800&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=26800&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=26800&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26800&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=26800&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=26800&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=26800&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26800&r=float

Reply via email to