From: ymgve dot aa at gmail dot com Operating system: Windows PHP version: 5.4.9 Package: Performance problem Bug Type: Bug Bug description:array_key_exists extremely slow on referenced arrays
Description: ------------ When you use array_key_exists() on a referenced array, it performs extremely slow compared to isset(): isset time 0.0053699016571045 size 0 isset time 0.0051219463348389 size 10 isset time 0.0032069683074951 size 100 isset time 0.0034000873565674 size 1000 isset time 0.0052909851074219 size 10000 array_key_exists time 0.0055620670318604 size 0 array_key_exists time 0.010941982269287 size 10 array_key_exists time 0.048230886459351 size 100 array_key_exists time 0.38906383514404 size 1000 array_key_exists time 5.6351599693298 size 10000 Due to the time increasing near linearly with the number of elements in the array, I assume the code for some reason looks through the array key linearly instead of using a hash lookup. Test script: --------------- http://pastebin.com/PVrf96an -- Edit bug report at https://bugs.php.net/bug.php?id=63736&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63736&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63736&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63736&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63736&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63736&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63736&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63736&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63736&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63736&r=support Expected behavior: https://bugs.php.net/fix.php?id=63736&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63736&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63736&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63736&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63736&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63736&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63736&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63736&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63736&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63736&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63736&r=mysqlcfg