]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: tools: improve ptr hash distribution on 64 bits
authorWilly Tarreau <w@1wt.eu>
Fri, 11 Aug 2023 18:11:30 +0000 (20:11 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 12 Aug 2023 17:04:34 +0000 (19:04 +0200)
commit58946d44f87e982a83f6ce34f7aefae37425e45c
tree198814cc61faf1fda3b39f639447247338d3d118
parentab6cb5dea035d180bc9461b4739d90dc9c1d2aaf
MINOR: tools: improve ptr hash distribution on 64 bits

When testing the pointer hash on 64-bit real pointers (map entries),
it appeared that the shift by 33 bits that hoped to compensate for the
3 nul LSB degrades the hash, and the centering is more optimal on
31-(bits+1)/2. This makes sense since the topmost bit of the
multiplicator is 31, so for an input of 1 bit and 1 bit of output we
would always get zero. With the formula adjusted this way, we can get
up to ~15% more unique entries at 10 bits and ~24% more at 11 bits.
include/haproxy/tools.h