Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86705 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66247 invoked from network); 16 Jun 2015 07:25:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jun 2015 07:25:26 -0000 Authentication-Results: pb1.pair.com header.from=julienpauli@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=julienpauli@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.43 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 74.125.82.43 mail-wg0-f43.google.com Received: from [74.125.82.43] ([74.125.82.43:35039] helo=mail-wg0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 08/9D-15639-56FCF755 for ; Tue, 16 Jun 2015 03:25:26 -0400 Received: by wgbhy7 with SMTP id hy7so5515561wgb.2 for ; Tue, 16 Jun 2015 00:25:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=wPIiNYJxv3ubzpSIUqaxygK3p/9F9pS8kn0vs8GzpGk=; b=mPurknMHnZRcS6msNAgoh/PvyYAIL9RyrFg8G4DYKKeVa1Z2wm7qPfa8uKFxHsnfJs EsTpJPftMYJcFE7QoOiXYva00+kh4vHmWpsf/gzMj0f7gZPAArBX7ExW5XkpPGWJY8TC m5ZqYVhMMeZB74zDLk6Y17qYH0D5ilv2W4cI4pFyXUiOprOrxMH8p2L5kdK+E4PA9+aV 4bcaoVaxSRXdxzvluHZqJmGXvn6e9WuCypGO0em7qs+/WXMU6zri40xTFM/WyVP4bep+ B4v7O/iA4DiX8GFZDuNN5hwAVSpT7yfL2YoU25s4EIKXdxQn9gtvrIIIjaU91yNzyxAi 3Giw== X-Received: by 10.180.211.77 with SMTP id na13mr3680433wic.76.1434439522618; Tue, 16 Jun 2015 00:25:22 -0700 (PDT) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.194.120.198 with HTTP; Tue, 16 Jun 2015 00:24:42 -0700 (PDT) In-Reply-To: References: Date: Tue, 16 Jun 2015 09:24:42 +0200 X-Google-Sender-Auth: kaEWhOi3h2NNe1eSUuELfgkDvhw Message-ID: To: Yasuo Ohgaki Cc: Dmitry Stogov , Levi Morrison , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a11c261a432957405189d7ac7 Subject: Re: [PHP-DEV] Packed array is not fast? From: jpauli@php.net (Julien Pauli) --001a11c261a432957405189d7ac7 Content-Type: text/plain; charset=UTF-8 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 wrote: > Hi Dmitry, > > On Mon, Jun 15, 2015 at 6:06 PM, Dmitry Stogov 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 > --001a11c261a432957405189d7ac7--