Re: Packed array is not fast?

From: Date: Tue, 16 Jun 2015 07:24:42 +0000
Subject: Re: Packed array is not fast?
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-86705@lists.php.net to get a copy of this message
Just to throw back another discussion based on this topic, has anyone considered changing the hash algorithm about string keys (real hashes) ? I gave MurmurHash2 a try, it was twice faster than DJB33 in my benchs (64bits platform and 64bits MurmurHash2 variant). 128bits MurmurHash3 however was a little bit slower than DJB33. I did not analyze collision risks though, but a valgrind/calgrind bench on many scenarios showed a better response time and a better zend_hash_func() response time with MurmurHash2. Julien.P On Tue, Jun 16, 2015 at 3:28 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote: > 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 >

« previous php.internals (#86705) next »