|
From: | Richard Henderson |
Subject: | Re: [Qemu-devel] [PATCH 07/10] tb hash: hash phys_pc, pc, and flags with xxhash |
Date: | Tue, 5 Apr 2016 09:07:57 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 |
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~
[Prev in Thread] | Current Thread | [Next in Thread] |