Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86707 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80230 invoked from network); 16 Jun 2015 09:53:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jun 2015 09:53:23 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.213.48 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.213.48 mail-yh0-f48.google.com Received: from [209.85.213.48] ([209.85.213.48:36404] helo=mail-yh0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 44/00-14163-F02FF755 for ; Tue, 16 Jun 2015 05:53:23 -0400 Received: by yhan67 with SMTP id n67so7594158yha.3 for ; Tue, 16 Jun 2015 02:53:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=26Y24E+ooQrWBbdXU8R/wK4UNp5gpBdEOVN1KjPl9l8=; b=EkGrnW836bk24G7yqunKPubMIOQ7Y8b07du+sqHW4eB0hvJpz+t6yV4xYWVWpINw6o cD8N5ynAjiaL5asKNwfR7DgSu8v7UnV8715W8iR6pa5bZzo9mLWO1GY1h0Vnxtw3HMYL rn9HzOlsmtWjKYwK3/0qO7XzRYLUYVYR5j9vPXjObZVRj9SOkdASmLItj5U6m1qdJv7u DadVW65y1lGX4oAsdmZy+frp5IMNZJbQygDIztBz3AbgYG1JrXhf20m2rsgBMfbv2BvW hK8cLZXZzA9b8WQ0G1uFYlZ+MviiBUgxkJgObYdONaKTdcKt5ucbTZ18C8I1gQniDQ5K q9Jw== X-Gm-Message-State: ALoCoQnDVT9V7C/X0eQrRGv89eiGEZyQ5tot6sZ17ve3dYfukC/N71CVBpN+6r4cdX4NESh+gsd0Yb/TK2F99l3+4sJx4YV6F+a1aACSZlrIVG6k5ns9VICFlVogJ/DsevJLwl703Im1Sbc1AxitJGmTxcUKrdY1Q90hA4dsH5b1CabXyjiu0Kg= MIME-Version: 1.0 X-Received: by 10.52.35.107 with SMTP id g11mr17528893vdj.37.1434448397261; Tue, 16 Jun 2015 02:53:17 -0700 (PDT) Received: by 10.31.10.201 with HTTP; Tue, 16 Jun 2015 02:53:17 -0700 (PDT) In-Reply-To: References: Date: Tue, 16 Jun 2015 12:53:17 +0300 Message-ID: To: Julien Pauli Cc: Yasuo Ohgaki , Levi Morrison , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=20cf3079c0a42b099205189f8b23 Subject: Re: [PHP-DEV] Packed array is not fast? From: dmitry@zend.com (Dmitry Stogov) --20cf3079c0a42b099205189f8b23 Content-Type: text/plain; charset=UTF-8 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. On Tue, Jun 16, 2015 at 10:24 AM, Julien Pauli wrote: > 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 >> > > --20cf3079c0a42b099205189f8b23--