Benchmarks
-------------------------
These measurements were performed in August 2020.
The reference system uses an Intel i7-9700K cpu, and runs Ubuntu x64 20.04.
The [open source benchmark program] is compiled with `clang` v10.0 using `-O3` flag.
Bandwidth tests are measured on a 100 KB input, which stays in CPU cache.
The _memcpy_ reference, in contrast, is measured from RAM.
It shows that some algorithms can process data faster than RAM can deliver it, so hash is no longer the bottleneck.
_Small data velocity_ is a _rough_ evaluation of an algorithm's efficiency on small inputs;
see [the wiki](https://github.com/Cyan4973/xxHash/wiki/Performance-comparison#benchmarks-concentrating-on-small-data-) for a detailed analysis.
| Hash Name | Width | Bandwidth (GB/s) | Small Data Velocity | Quality | Comment |
| --------- | ----- | ---------------- | ----- | --- | --- |
| __XXH3__ (AVX2) | 64 | 59.4 GB/s | 133.1 | 10 | AVX2 support (optional)
| __XXH128__ (AVX2) | 128 | 57.9 GB/s | 118.1 | 10 | AVX2 support (optional)
| __XXH3__ (SSE2) | 64 | 31.5 GB/s | 133.1 | 10 |
| __XXH128__ (SSE2) | 128 | 29.6 GB/s | 118.1 | 10 |
| _memcpy (from RAM)_| N/A | 28.0 GB/s | N/A | N/A | _from RAM, for reference_
| City64 | 64 | 22.0 GB/s | 76.6 | 10 |
| T1ha2 | 64 | 22.0 GB/s | 99.0 | 9 | Slightly worse [collisions]
| City128 | 128 | 21.7 GB/s | 57.7 | 10 |
| __XXH64__ | 64 | 19.4 GB/s | 71.0 | 10 |
| SpookyHash | 64 | 19.3 GB/s | 53.2 | 10 |
| Mum | 64 | 18.0 GB/s | 67.0 | 9 | Slightly worse [collisions]
| __XXH32__ | 32 | 9.7 GB/s | 71.9 | 10 |
| City32 | 32 | 9.1 GB/s | 66.0 | 10 |
| Murmur3 | 32 | 3.9 GB/s | 56.1 | 10 |
| SipHash | 64 | 3.0 GB/s | 43.2 | 10 |
| FNV64 | 64 | 1.2 GB/s | 62.7 | 5 | Poor avalanche properties
| Blake2 | 256 | 1.1 GB/s | 5.1 | 10 | Cryptographic
| SHA1 | 160 | 0.8 GB/s | 5.6 | 10 | Cryptographic but broken
| MD5 | 128 | 0.6 GB/s | 7.8 | 10 | Cryptographic but broken
[open source benchmark program]: https://github.com/Cyan4973/xxHash/tree/release/tests/bench
[collisions]: https://github.com/Cyan4973/xxHash/wiki/Collision-ratio-comparison#collision-study
note: On 32-bit applications, the ranking between hashes differs drastically, strongly favoring 32-bit hashes,
See [this section of the wiki](https://github.com/Cyan4973/xxHash/wiki/Performance-comparison#bandwidth-on-x86-with-various-data-size-of-len-2n-32-bit-friendliness) for illustration.
### Bandwidth per platform
|Platform |Variant |Bandwidth
|-- |-- |--
|Intel i7-9700K |__XXH3__ (AVX2) |59.4 GB/s
|Intel i7-9700K |__XXH128__ (AVX2)|57.9 GB/s
|Intel i7-9700K |__XXH3__ (SSE2) |31.5 GB/s
|Intel i7-9700K |__XXH128__ (SSE2)|29.6 GB/s
|Intel i7-9700K |_memcpy_ (from RAM)|28.0 GB/s
|Intel i7-9700K |__XXH64__ |19.4 GB/s
|Intel i7-9700K |__XXH32__ |9.7 GB/s
|Apple M1 Pro |_memcpy_ (from RAM)|45 GB/s
|Apple M1 Pro |__XXH3__ (NEON) |36.3 GB/s
|Apple M1 Pro |__XXH128__ (NEON)|35.1 GB/s
|Apple M1 Pro |__XXH64__ |13.4 GB/s
|Apple M1 Pro |__XXH32__ |6.6 GB/s
|AMD Zen 5 |__XXH3__ (AVX512)|159 GB/s
|AMD Zen 5 |__XXH128__ (AVX512)|156 GB/s
|AMD Zen 5 |__XXH3__ (AVX2) |84.0 GB/s
|AMD Zen 5 |__XXH128__ (AVX2)|83.5 GB/s
|AMD Zen 5 |__XXH3__ (SSE2) |38.9 GB/s
|AMD Zen 5 |__XXH128__ (SSE2)|37.4 GB/s
|AMD Zen 5 |_memcpy_ (from RAM)|28.5 GB/s
|AMD Zen 5 |__XXH64__ |27.8 GB/s
|AMD Zen 5 |__XXH32__ |13.8 GB/s
## Multiple languages
The following versions produce xxHash-compatible results in different languages.
To write one yourself, follow the [format specification].
[format specification]: https://github.com/Cyan4973/xxHash/blob/dev/doc/xxhash_spec.md
|Language |Author |URL
|-- |-- |--
|__C__ multithreaded |Shawn Bayern |https://github.com/shawnbayern/xxHash
|__C#__ (std pkg) |Microsoft |https://learn.microsoft.com/en-us/dotnet/api/system.io.hashing?view=net-9.0-pp
|__C#__ (port) |Melnik Alexander |https://github.com/uranium62/xxHash
|__C#__ (.net std 2.0) |Sedat Kapanoğlu |https://github.com/ssg/HashDepot#xxhash
|__C++__ (simple) |Stefan Brumme |https://create.stephan-brumme.com/xxhash/
|__C++__ constexpr (XXH64) |Daniel Kirchner |https://github.com/ekpyron/xxhashct
|__C++__ constexpr (XXH32) |Takayuki Matsuoka |https://github.com/Cyan4973/xxHash/issues/496
|__C++__ constexpr (XXH3) |chys87 |https://github.com/chys87/constexpr-xxh3
|__C++ 17__ |Red Gavin |https://github.com/RedSpah/xxhash_cpp
|__Crystal__ |Lucjan Suski |https://github.com/methyl/xxhash
|__D__ |Masahiro Nakagawa |https://github.com/repeatedly/xxhash-d
|__Dart__ (XXH3) |SamJakob |https://pub.dev/packages/xxh3
|__Elixir__ (nif) |Ali Farhadi |https://github.com/farhadi/xxh3
|__Elixir__ (port) |Mykola Konyk |https://github.com/ttvd/elixir-xxhash
|__Erlang__ |Pierre Matri |https://github.com/pierresforge/erlang-xxhash
|__Erlang__ (XXH3) |Ali Farhadi |https://github.com/farhadi/xxh3
|__Go__ (XXH64) |Ahmed Waheed |https://github.com/OneOfOne/xxhash
|__Go__ (XXH3) |Jeff Wendling |https://github.com/zeebo/xxh3
|__Go + ASM__ |Caleb Spare |https://github.com/cespare/xxhash
|__Haskell__ |Henri Verroken |http://hackage.haskell.org/package/xxhash-ffi
|__Haskell__ (port) |Christian Marie |http://hackage.haskell.org/package/xxhash
|__Java__ |Adrien Grand |https://github.com/lz4/lz4-java/tree/master/src/java/net/jpountz/xxhash
|__Java__ (all, port) |Dynatrace |https://github.com/dynatrace-oss/hash4j/blob/main/src/main/java/com/dynatrace/hash4j/hashing/XXH3_64.java
|__Java__ (XXH3, XXH128) |James Z.M. Gao |https://github.com/OpenHFT/Zero-Allocation-Hashing/blob/master/src/main/java/net/openhft/hashing/XXH3.java
|__JavaScript__ (WebAssembly)|Michael Jungo |https://www.npmjs.com/package/xxhash-wasm
|__JavaScript__ (port) |Pierre Curto |https://npmjs.org/package/xxhashjs
|__JavaScript__ (nodeJS) |Brian White |https://npmjs.org/package/xxhash
|__JavaScript__ (nodeJS, xxh3)|Nhan Khong |https://github.com/ktrongnhan/xxhash-addon
|__JavaScript__ (React Native)|Alex Shumihin |https://github.com/pioner92/react-native-xxhash
|__JSX__ (static JavaScript)|Yoshiki Shibukawa |https://www.npmjs.org/package/xxhash.jsx
|__Julia__ |Hanan Rosemarin |https://github.com/hros/XXhash.jl
|__Kotlin__ |Matthew Dolan |https://github.com/appmattus/crypto/tree/main/cryptohash
|__Lua__ (binding) |Masatoshi Teruya |https://github.com/mah0x211/lua-xxhash
|__Lua__ (jit, XXH32) |szensk |https://github.com/szensk/luaxxhash
|__Lua__ (jit, XXH64) |Soojin Nam |https://github.com/sjnam/luajit-xxHash
|__OCaml__ |Pieter Goetschalckx|http://opam.ocaml.org/packages/xxhash/
|__Pascal__ |Vojtěch Čihák |http://sourceforge.net/projects/xxhashfpc
|__Perl__ |Sanko Robinson |https://metacpan.org/module/Digest::xxHash
|__Perl__ (streaming) |Bela Bodecs |https://github.com/DoubleBB/digest-xxhash64
|__PHP__ |Nir Heimann |https://github.com/nheimann1/php-xxhash
|__PHP__ (port) |Scott Dutton |https://github.com/exussum12/xxhash
|__PHP7__ |Craig R Megasaxon |https://github.com/Megasaxon/php-xxhash
|__PHP8__ |Anatol Belski |https://php.watch/versions/8.1/xxHash
|__PicoLisp__ |mpech |https://git.envs.net/mpech/xxhash-picolisp
|__Python__ |Yue Du |https://pypi.python.org/pypi/xxhash/
|__R__ |Dirk Eddelbuettel |https://github.com/eddelbuettel/digest
|__R__ (XXH3) |mikefc |https://github.com/coolbutuseless/xxhashlite
|__Ruby__ (port) |Justin W Smith |http://rubygems.org/gems/ruby-xxHash
|__Ruby__ (wrapper) |Vasiliy Ermolovich |https://rubygems.org/gems/xxhash
|__Ruby__ (digest::class) |konsolebox |https://rubygems.org/gems/digest-xxhash
|__Rust__ |Jake Goulding |https://libraries.io/cargo/twox-hash
|__Rust__ (const xxh3) |Arthur Martirosyan |https://crates.io/crates/xxhash-rust
|__Scala__ |Desmond Yeung |https://github.com/desmondyeung/scala-hashing
|__Swift__ |Daisuke T |https://github.com/daisuke-t-jp/xxHash-Swift
|__Tcl__ (XXH32, port) |D. Bohdan |https://wiki.tcl-lang.org/48790
|__Zig__ |ziglang |https://github.com/Cyan4973/xxHash/issues/1001
#### Shells and assembly
|Language |Author |URL
|-- |-- |--
|__Bash__ (port) |Devin Hussey |https://github.com/easyaspi314/xxbash
|__Batch__ (XXH32, port) |Antonio Aacini |https://github.com/Aacini/xxHash32
|__sh__ (port) |Jan Chren |https://gitlab.com/rindeal/xxHashish
|__x86 assembly__ (XXH32) |Antonio Aacini |https://github.com/Aacini/xxHash32
## xxHash is used by
#### Systems & Infrastructure
#### Databases
#### Games
#### Filters
#### File Transfer
#### Other
### Special Thanks to
- [Takayuki Matsuoka](https://github.com/t-mat/) for creating `xxhsum -c` and the canvas of this webpage.
- [Mathias Westerdahl](https://github.com/JCash) for introducing the first version of XXH64.
- [Devin Hussey](https://github.com/easyaspi314) for the excellent low-level optimizations on XXH3 and XXH128.
---