Skip to content

koron/java-xxhash-benchmark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Benchmark hash speed: xxHash vs MurmurHash3 vs Arrays#hashCode

$ gradle run
Format: {LABEL} : {MINUS HASH COUNT}/{ITERATION COUNT} {ELAPSED NANOTIME}
xxHash          : 500586/1000000 (50.06%) 99,217,166
MurmurHash3     : 500026/1000000 (50.00%) 97,412,585
SipHash         : 499198/1000000 (49.92%) 160,292,361
Arrays#hashCode : 501062/1000000 (50.11%) 133,030,834

*** 64bit hash ***
Format: {LABEL} : {MINUS HASH COUNT}/{ITERATION COUNT} {ELAPSED NANOTIME}
xxHash          : 500200/1000000 (50.02%) 116,134,825
ZAH-city11      : 499568/1000000 (49.96%) 67,066,183
ZAH-farmNa      : 500519/1000000 (50.05%) 47,524,742
ZAH-murmur3     : 500130/1000000 (50.01%) 64,455,274
ZAH-xxHash      : 500586/1000000 (50.06%) 48,073,898
Guava-murmur3   : 500032/1000000 (50.00%) 280,833,606
Guava-siphash   : 500248/1000000 (50.02%) 393,090,981

Facts

  • xxhash is faster 1.5 times than Arrays#hashCode.
  • xxhash is little faster than MurmurHash3

Prospects

  • Hash speed is not significant in some kind of benchmarks, because other logics (memory access or so) take most of time.

Appendix

Hash Implementation

Algorithm URL
xxHash https://github.com/koron/java-xxhash
MurmurHash3 https://github.com/yonik/java_util
SipHash https://github.com/nahi/siphash-java-inline

About

Compare speed of hash algorithms

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published