note 46500 added to function.array-key-exists
| From: | nickcopenl at osu1 dot php dot net | Date: | Wed, 13 Oct 2004 12:31:10 +0000 |
| Subject: | note 46500 added to function.array-key-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-78485@lists.php.net to get a copy of this message | ||
array_key_exists() is in some circumstances MUCH slower than isset().
We had a case where a heavily recursive function used array_key_exists() to early exit. It went from
50 to 4 seconds when array_key_exists() was replaced with isset(). The funny thing was that with
replacing the first array_key_exists() the benefit was 25% while the benefit with the second one was
a factor of 20.
The timing includes the generation of the graph with jpgraph and some other work.
----
Manual Page -- http://www.php.net/manual/en/function.array-key-exists.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46500
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46500&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+46500&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+46500&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+46500&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+46500&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+46500&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46500&report=yes
Search -- http://master.php.net/manage/user-notes.php