A C++ library for writing microbenchmarks that time small code snippets, similar in structure to unit tests.
rurban/smhasher
A test suite that measures the speed and statistical quality of hash functions, with a large table of tested implementations.
- Stars
- 2,183
- Forks
- 192
- Open issues
- 45
- Last commit
- 16 days ago
What is it?
SMHasher is a test suite for hash functions. It runs a set of speed benchmarks on bulk and small keys, measures hash-map lookup cost, and applies statistical quality tests such as collision counting, bias, avalanche and sanity checks to reveal weaknesses in a function's output.
The repository also publishes a large comparison table covering hundreds of non-cryptographic and cryptographic hash functions, including MurmurHash, xxHash, wyhash, CityHash, FarmHash, SipHash and many others. Each entry lists throughput, cycles per small hash, hash-map performance, object size, and the quality tests a function fails. Results are provided for several CPUs, from desktop x86 to a 32-bit ARM phone.
The author's conclusions are included alongside the data. They note that fast hashes with minor quality flaws often perform well in real hash tables, while security-sensitive uses need cryptographic or keyed designs.
Key features
- 01Benchmarks bulk-key throughput and small-key hashing cost in cycles.
- 02Measures hash-map lookup performance and object size for inlining analysis.
- 03Runs statistical quality tests for collisions, bias, avalanche and sanity.
- 04Publishes sortable comparison tables across several CPU platforms.
Use cases
- Choosing a hash function for a hash table or symbol table implementation.
- Comparing the speed and quality of candidate hashes before adopting one.
- Validating a new hash function implementation against known test suites.
- Studying trade-offs between hash speed, collision behavior and hash-table performance.
Things to know
- The license is not clearly stated (metadata reports NOASSERTION), so reuse terms are unclear.
In collections
Topics
FAQ
- What is smhasher?
- A test suite that measures the speed and statistical quality of hash functions, with a large table of tested implementations. SMHasher is a test suite for hash functions. It runs a set of speed benchmarks on bulk and small keys, measures hash-map lookup cost, and applies statistical quality tests such as collision counting, bias, avalanche and sanity checks to reveal weaknesses in a function's output.
- Is smhasher free to use? What license does it have?
- smhasher is open source under the Other license. Check the license terms before using it in commercial products.
- Is smhasher still maintained?
- Actively maintained. The last commit to smhasher was on Oct 22, 2026.
- What can I use smhasher for?
- Choosing a hash function for a hash table or symbol table implementation. Comparing the speed and quality of candidate hashes before adopting one. Validating a new hash function implementation against known test suites. Studying trade-offs between hash speed, collision behavior and hash-table performance.
- Where can I get smhasher?
- The source code and installation instructions are on GitHub: https://github.com/rurban/smhasher
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A C library for extremely fast non-cryptographic hashing, producing identical 32, 64 and 128-bit hashes across platforms.
Open-source Java application for load testing and measuring the performance of web applications and other services.
A unit and component testing framework powered by Vite, reusing your Vite config, transformers and plugins for tests.
A Python testing framework that makes it easy to write small tests and scales to complex functional testing for applications and libraries.
A Rust procedural macro that uses the ChatGPT API to generate function bodies and test cases at compile time.