From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1anTWR-00077W-7e for qemu-devel@nongnu.org; Tue, 05 Apr 2016 12:08:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1anTWL-00007U-Lq for qemu-devel@nongnu.org; Tue, 05 Apr 2016 12:08:07 -0400 Received: from mail-qg0-x243.google.com ([2607:f8b0:400d:c04::243]:36771) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1anTWL-00007Q-HJ for qemu-devel@nongnu.org; Tue, 05 Apr 2016 12:08:01 -0400 Received: by mail-qg0-x243.google.com with SMTP id f105so1616735qge.3 for ; Tue, 05 Apr 2016 09:08:01 -0700 (PDT) Sender: Richard Henderson References: <1459834253-8291-1-git-send-email-cota@braap.org> <1459834253-8291-8-git-send-email-cota@braap.org> <5703DCB7.50302@twiddle.net> <5703DE37.3080306@redhat.com> From: Richard Henderson Message-ID: <5703E2DD.3020103@twiddle.net> Date: Tue, 5 Apr 2016 09:07:57 -0700 MIME-Version: 1.0 In-Reply-To: <5703DE37.3080306@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 07/10] tb hash: hash phys_pc, pc, and flags with xxhash List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , "Emilio G. Cota" , QEMU Developers , MTTCG Devel Cc: Peter Maydell , Sergey Fedorov , =?UTF-8?Q?Alex_Benn=c3=a9e?= , Peter Crosthwaite On 04/05/2016 08:48 AM, Paolo Bonzini wrote: > I think it's fine to use the struct. The exact size of the struct > varies from 3 to 5 32-bit words, so it's hard to write nice > size-dependent code for the hash. I don't think it is. We have 3 integers. It is trivial to create a simple function of 2 multiplies, two adds, and a remainder. Take the primes from the xxhash.h, for example: (phys_pc * PRIME32_2 + pc * PRIME32_3 + flags) % PRIME32_1 & (CODE_GEN_PHYS_HASH_SIZE - 1) Obviously, some bucket measurements should be taken, but I can well imagine that this might perform just as well as the fully generic hasher. r~