The following charts show the most important results of our Java hash functions performance benchmarks. For details, have a look at the Java hash function data PDF
In this test, our Murmur3 implementations perform pretty well. Murmur3F outperforms Java’s CRC32 by factor 4 and Guava’s implementation of the same hash by factor 10.
Two observations: 1.) Adler32 is outdated (and wasn’t designed as a hash). 2.) All other hash functions and the CRC checksum perform equally well with random data.
Test platform: Intel® Core™ i7-3720QM (2012), Windows 8 (64 bit), Java 7u72
Other comparisons
- http://www.strchr.com/hash_functions
- http://programmers.stackexchange.com/questions/49550/which-hashing-algorithm-is-best-for-uniqueness-and-speed
- http://research.neustar.biz/2012/02/02/choosing-a-good-hash-function-part-3/
- http://jpountz.github.io/lz4-java/1.2.0/xxhash-benchmark/
- http://blog.reverberate.org/2012/01/state-of-hash-functions-2012.html
- http://floodyberry.com/noncryptohashzoo/
Misc
Other interesting hash functions
- Another simple Murmur3a Java implementation in the public domain:
http://github.com/yonik/java_util - CityHash can make use of hardware CRC:
http://en.wikipedia.org/wiki/CityHash and https://code.google.com/p/cityhash/ - Hash classics by Bob Jenkins:
http://en.wikipedia.org/wiki/Jenkins_hash_function - And Bob Jenkins’ modern 128-bit SpookyHash:
http://www.burtleburtle.net/bob/hash/spooky.html - SipHash 64 bits has a secret 128 bit key and claims to be strong against DoS attacks:
http://en.wikipedia.org/wiki/SipHash - A lesser known hash function claiming to be very fast while maintaining good SMHasher properties:
https://code.google.com/p/fast-hash/ - xxHash claims to be fast for current x86 while having great hashing properties (however, the tested Java version produced lots of hash collisions):
https://code.google.com/p/xxhash/
Hash function studies
“Empirical Evaluation of Hash Functions for Multipoint Measurements”, Christian Henke, Carsten Schmoll, Tanja Zseby, ACM SIGCOMM Computer Communication Review archive Volume 38 Issue 3, July 2008, Pages 39-50.