Re: Packed array is not fast?
| From: | Yasuo Ohgaki | Date: | Tue, 16 Jun 2015 01:28:26 +0000 |
| Subject: | Re: Packed array is not fast? | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-86703@lists.php.net to get a copy of this message | ||
Hi Dmitry,
On Mon, Jun 15, 2015 at 6:06 PM, Dmitry Stogov <dmitry@zend.com> wrote:
> I see only the test for "packed" array. You may create similar "hash"
> array, initializing it in reverse order.
>
It's better approach to see the difference because the array content is
basically the same.
>
> In my experiments "packed" arrays are slightly (8%) faster.
>
> $ sapi/cli/php packed.php
> Time: 0.022471189498901
> Time: 0.012310028076172
>
> $ sapi/cli/php hash.php
> Time: 0.024425029754639
> Time: 0.012874126434326
It's faster on my PC, too.
8% is good enough to have.
I'm surprised that PHP's hash is super fast :)
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net