A fast, memory-efficient hash map implementation for C++ with minimal memory overhead during resizing.
Sparsepp is a C++ hash map library that provides a fast, memory-efficient alternative to std::unordered_map and std::unordered_set. It solves the problem of high memory overhead during resizing in open-addressing hash tables while maintaining excellent performance and low per-entry memory usage.
C++ developers who need high-performance associative containers with minimal memory footprint, particularly those working in memory-constrained environments or with large datasets.
Developers choose Sparsepp for its unique combination of speed and memory efficiency, offering better performance than standard unordered_map implementations with significantly lower memory overhead, especially during resize operations.
A fast, memory efficient hash map for C++
Typically adds only about one byte overhead per entry and minimizes memory spikes during resizing, making it ideal for memory-constrained applications like embedded systems.
Benchmarks show it often outperforms std::unordered_map and Boost implementations, providing faster lookups and insertions due to its open addressing design.
API is identical to std::unordered_map and unordered_set, allowing seamless replacement without code changes, as demonstrated in the example usage.
Includes serialize() and unserialize() methods with customizable serializers, simplifying data persistence to files or networks, as shown in the FileSerializer example.
Erasing or inserting elements frequently invalidates iterators and references, complicating code that relies on element stability, a drawback not present in std::unordered_map.
On Windows, the custom allocator (SPP_USE_SPP_ALLOC) can waste memory for small hash maps by creating new 4K memory spaces per instance, increasing overhead in some scenarios.
The author now recommends parallel hashmap for a better trade-off, indicating Sparsepp may be suboptimal for new projects unless specific constraints like non-C++11 compilers apply.
A family of header-only, very fast and memory-friendly hashmap and btree containers.
Roaring bitmaps in C (and C++), with SIMD (AVX2, AVX-512 and NEON) optimizations: used by Apache Doris, ClickHouse, Alibaba Tair, Redpanda, YDB and StarRocks
Fast & memory efficient hashtable based on robin hood hashing for C++11/14/17/20
C++ implementation of a fast hash map and hash set using robin hood hashing
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.