note 95125 added to class.splfixedarray
| From: | randallgirard at hotmail dot com | Date: | Mon, 14 Dec 2009 21:08:41 +0000 |
| Subject: | note 95125 added to class.splfixedarray | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-163961@lists.php.net to get a copy of this message | ||
NOTE: This only affects CREATION time, NOT access time.
It does NOT create a true indexed array (which is what I was hoping for) but is still associative
like all PHP arrays. The class requires a numeric key because it builds the array with a set number
of items but still operates under the hood associatively. (or this is my assumption, as I performed
benchmarks comparing 100,000 reads on a standard array and an SplFixedArray: Results were the same,
while a true indexed array SHOULD in theory be faster than an associative)
The only performance gain is that you are not building the array piece by piece; Rather, the entire
array is built at once and you can then fill it's values by numeric indexes... Therefor it is
only reducing the creation overhead.
This is only useful in a situation when you know the size your array will be, for example filling it
with items from a database query.
----
Server IP: 69.147.83.197
Probable Submitter: 76.167.60.11
----
Manual Page -- http://www.php.net/manual/en/class.splfixedarray.php
Edit -- https://master.php.net/note/edit/95125
Del: integrated -- https://master.php.net/note/delete/95125/integrated
Del: useless -- https://master.php.net/note/delete/95125/useless
Del: bad code -- https://master.php.net/note/delete/95125/bad+code
Del: spam -- https://master.php.net/note/delete/95125/spam
Del: non-english -- https://master.php.net/note/delete/95125/non-english
Del: in docs -- https://master.php.net/note/delete/95125/in+docs
Del: other reasons-- https://master.php.net/note/delete/95125
Reject -- https://master.php.net/note/reject/95125
Search -- https://master.php.net/manage/user-notes.php