Re: Packed array is not fast?
| From: | Julien Pauli | Date: | Tue, 16 Jun 2015 11:04:06 +0000 |
| Subject: | Re: Packed array is not fast? | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-86708@lists.php.net to get a copy of this message | ||
First of all, I tried it against a PHP5 codebase, not PHP7.
I simply patched it about return type (casted it to our ulong , taking care
of 32/64 platforms), then I very simply #define zend(_inline)_hash_func to
mumurhash2.
Then I ran a callgrind on an extension of mine (closed source), that
heavily makes use of zend_inline_hash_func.
I noticed with callgrind result graph that this latter took twice less time
when the macro was defined to target murmurhash2 than DJB33.
And the zend_hash_quick_****() calls called later with such a hash did not
seem to take longer time, though the collision rate stayed barely the same.
This is a quick test as #defining in an extension is abviously not safe at
all, but as I fully use the _quick_ API, the compiled PHP codebase doesnt
make use of zend_hash_func itself (which would lead to DJB33)
Julien.P
On Tue, Jun 16, 2015 at 11:53 AM, Dmitry Stogov <dmitry@zend.com> wrote:
> Hi Julien,
>
> Could you be more specific. From the first look MurmurHash2is more
> expensive, but may be it reduces number of collisions.
> what implementation(s) did you use (src or patch)? how did you measure the
> speed? did you try to embed it into PHP?
>
> Thanks. Dmitry.
>