Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eSKyq-0006qO-BC for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Dec 2017 10:55:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eSKyp-0007jX-Ih for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Dec 2017 10:55:07 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eSKyp-0007iT-41 for pgsql-hackers@lists.postgresql.org; Fri, 22 Dec 2017 10:55:07 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eSKyi-0000jK-J5 for pgsql-hackers@postgresql.org; Fri, 22 Dec 2017 10:55:05 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 052E721C1AA1; Fri, 22 Dec 2017 13:54:58 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from zilders-MacBook-Pro.local (gw.postgrespro.ru [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id CEBFC21C0452; Fri, 22 Dec 2017 13:54:57 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1513940097; bh=5+tF2pb86S6+Gplw7YTb+pjIG0VgOgnAzPdcGNzN8Ro=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=Yyuo6DvcYMLMIcFqmJsmMb5wwP3ToHs1BvEpkhbDzeARQl+38AUNs1l0LCZXo7vr5 BZLtmGCxS+dxFB0jnoiSLBFU6gPxmwXT2GKJIxPkEhoawGqNAZkcp/SKWaaArlo/MM tbao7mbRpkeetLawY3Aqkq4HBUj7Jmb4uwTT9CMg= Subject: Re: General purpose hashing func in pgbench To: Fabien COELHO Cc: pgsql-hackers References: <0e8bd39e-dfcd-2879-f88f-272799ad7ef2@postgrespro.ru> <699225ee-c30c-b22e-4028-415e9eab26b2@postgrespro.ru> From: Ildar Musin Message-ID: <80e9c570-5c49-1a01-f309-3d8d0cbbae42@postgrespro.ru> Date: Fri, 22 Dec 2017 13:54:57 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: ru List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 21/12/2017 18:26, Fabien COELHO пишет: > >> I think it is not commitfest ready yet -- I need to add some >> documentation and tests first. > > Yes, doc & test are missing. > > From your figures, the murmur2 algorithm output looks way better. I'm > wondering whether it makes sense to provide a bad hash function if a > good/better one is available, unless the bad one actually appears in > some benchmark... So I would suggest to remove fnv1a. Actually the "bad" one appears in YCSB. But if we should choose the only one I would stick to murmur too given it provides better results while having similar computational complexity. > > One implementation put constants in defines, the other one uses "const > int". The practice in pgbench seems to use defines (eg > MIN_GAUSSIAN_PARAM...), so I would suggest to stick to this style. That had been my intention from the start until I coded it that way and it looked ugly and hard to read (IMHO), like:     k *= MURMUR2_M;     k ^= k >> MURMUR2_R;     k *= MURMUR2_M;     result ^= k;     result *= MURMUR2_M; ...etc. And besides it is not a parameter to be tuned and not something someone would ever want to change; it appears in just a single function. So I'd better leave it the way it is. Actually I was thinking to do the same to fnv1a too : ) -- Ildar Musin Postgres Professional: http://www.postgrespro.com Russian Postgres Company