Hashing faster than RAM speed
A non-cryptographic hash algorithm, proposed in four flavors: XXH32, XXH64, XXH3_64bits and XXH3_128bits.
All four are fully supported and specified. They differ in output width and in speed — the benchmarks show by how much.
| Variant | Output | Notes |
|---|---|---|
XXH3_64bits | 64-bit | Fastest, and the strongest on small inputs. The recommended default. |
XXH3_128bits | 128-bit | Same speed as XXH3_64bits, with a wider output. |
XXH64 | 64-bit | Fast on 64-bit platforms, and widely deployed. |
XXH32 | 32-bit | Fastest of the 32-bit hashes, and favoured on 32-bit targets. |
Single-threaded bandwidth on a 100 KB input, which stays in CPU cache. The memcpy bar is measured from RAM instead — it is there to show where the memory wall sits, not as a like-for-like comparison.
Measured with the open source benchmark program. On 32-bit targets the ranking shifts considerably in favour of 32-bit hashes — see the wiki.
Intel i7-9700K, Ubuntu x64 20.04, clang v10.0 -O3.
Small data velocity is a rough measure of efficiency on short inputs;
see the wiki
for the detailed analysis.
| Hash | Width | Bandwidth | Small data | Note |
|---|---|---|---|---|
| XXH3 (AVX2) | 64 | 59.4 GB/s | 133.1 | AVX2 support (optional) |
| XXH128 (AVX2) | 128 | 57.9 GB/s | 118.1 | AVX2 support (optional) |
| XXH3 (SSE2) | 64 | 31.5 GB/s | 133.1 | |
| XXH128 (SSE2) | 128 | 29.6 GB/s | 118.1 | |
| memcpy | — | 28.0 GB/s | — | from RAM, for reference |
| City64 | 64 | 22.0 GB/s | 76.6 | |
| T1ha2 | 64 | 22.0 GB/s | 99.0 | Slightly worse collisions |
| City128 | 128 | 21.7 GB/s | 57.7 | |
| XXH64 | 64 | 19.4 GB/s | 71.0 | |
| SpookyHash | 64 | 19.3 GB/s | 53.2 | |
| Mum | 64 | 18.0 GB/s | 67.0 | Slightly worse collisions |
| XXH32 | 32 | 9.7 GB/s | 71.9 | |
| City32 | 32 | 9.1 GB/s | 66.0 | |
| Murmur3 | 32 | 3.9 GB/s | 56.1 | |
| SipHash | 64 | 3.0 GB/s | 43.2 | |
| FNV64 | 64 | 1.2 GB/s | 62.7 | Poor avalanche properties |
| Blake2 | 256 | 1.1 GB/s | 5.1 | Cryptographic |
| SHA1 | 160 | 0.8 GB/s | 5.6 | Cryptographic but broken |
| MD5 | 128 | 0.6 GB/s | 7.8 | Cryptographic but broken |
xxHash compiled to WebAssembly, running in this page. Nothing is uploaded. Useful as a reference oracle when writing a port.
60 ports and bindings that produce xxHash-compatible digests. To write your own, follow the format specification and check yourself against the box above.
53 projects that ship xxHash. Missing one? Open an issue.