[LLVMdev] [PATCH] FoldingSetNodeID: use MurmurHash2 instead of SuperFastHash

Török Edwin edwintorok at gmail.com
Mon Feb 8 10:15:49 PST 2010


On 2010-02-06 17:09, Gregory Petrosyan wrote:
> Some additional info can be found at:
>
>   http://murmurhash.googlepages.com/
>   http://en.wikipedia.org/wiki/MurmurHash
>   http://www.codeproject.com/KB/recipes/hash_functions.aspx
>
> as well as in the patch description itself. Patch and benchmark attached.
>
>   
+/// This version additionally assumes that 'len % 4 == 0'. Below are the
+/// original notes.
+///
+/// Note - This code makes a few assumptions about how your machine
behaves -
+///
+/// 1. We can read a 4-byte value from any address without crashing

Doesn't it only need the start of the data to be 4-byte aligned?
That seems to be the case already, since this is a smallvector of unsigned.

+/// 2. sizeof(int) == 4

How about using uint32_t/int32_t instead of int then?

Best regards,
--Edwin



More information about the llvm-dev mailing list