[LLVMdev] a different hash for APInts

Robert G. Jakabosky bobby at sharedrealm.com
Wed Mar 11 16:16:43 PDT 2009


On Wednesday 11, Stuart Hastings wrote:
> I have NOT exhaustively tested this new hash function.  While the
> improvement on this particular testcase is undeniable, I suspect that
> for every hash function there is a pathological testcase that behaves
> badly.  Ergo, I offer this hash to the list for comment: Is this a
> good choice?  Is "hash ^= hash6432shift(pVal[i]);" a good choice for
> hashing multi-word integers?  Is there a better hash I should use
> instead? Should I be solving the problem in another way entirely?

Here are some good hash functions that I found when searching for a fast hash 
function.

http://www.isthe.com/chongo/tech/comp/fnv/
http://burtleburtle.net/bob/hash/doobs.html
http://www.azillionmonkeys.com/qed/hash.html
http://www.cse.yorku.ca/~oz/hash.html

I would recommend the FNV hash function from the first link.

Also here is Google's fast SparseHash (also has a dense version too):
http://goog-sparsehash.sourceforge.net/

-- 
Robert G. Jakabosky



More information about the llvm-dev mailing list