benchmarking Perl client hash functions

Larry Leszczynski
Mon, 19 Jul 2004 16:32:41 -0400 (Eastern Daylight Time)

On Mon, 19 Jul 2004, Brad Fitzpatrick wrote:

> >    'crc32'   meaning "(crc32(shift) >> 16) & 0x7fff"
> Where does 0x7fff come from?  Or 16 for that matter.
> Is there something magic about having 32767 buckets?

crc32 returns a 32-bit integer, so this just uses the top two bytes as the
hash value.  Why this is good, I don't know, but it seems to work pretty
well and is pretty fast.  While Googling I managed to find some references
that mention that using all 32 bits of the crc32 value did not give a
particularly good distribution, but I couldn't find anything mentioning
why using just the top half works better.  Maybe Troy (original poster)
can elaborate on the details.