Re: Packed array is not fast?
| From: | Dmitry Stogov | Date: | Mon, 15 Jun 2015 09:06:43 +0000 |
| Subject: | Re: Packed array is not fast? | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-86646@lists.php.net to get a copy of this message | ||
I see only the test for "packed" array. You may create similar "hash"
array, initializing it in reverse order.
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
Thanks. Dmitry.
On Mon, Jun 15, 2015 at 6:51 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
> Hi Levi,
>
> On Mon, Jun 15, 2015 at 12:35 PM, Levi Morrison <levim@php.net> wrote:
>
> > How are you testing hash vs packed? As far as what you posted I cannot
> > tell a difference – it looks like you are running the same thing twice
> > (same binary and same input file).
> >
>
> I've modified START index and verified both packed and unpacked array is
> used
> by using gdb. I didn't analyze whole execution, but only zend_hash.c
>
> I didn't paste slightly different code because it will not give us much
> difference
> and it's useless services like 3v4l.
>
> I'm a little disappointed by the result because I was expecting much better
> result with packed array..
>
> Regards,
>
> --
> Yasuo Ohgaki
> yohgaki@ohgaki.net
>