A fast, densely stored C++17+ hashmap and hashset using robin-hood backward shift deletion, offering near-drop-in replacements for std::unordered_map/set.
ankerl::unordered_dense is a C++17+ library providing fast, densely stored hashmap and hashset containers. It serves as a high-performance alternative to `std::unordered_map` and `std::unordered_set` by storing elements contiguously in a vector, significantly speeding up iterations and lookups while trading off some iterator stability guarantees.
C++ developers working on performance-sensitive applications, such as game engines, scientific computing, or high-frequency trading systems, who need faster associative containers than the STL provides.
Developers choose ankerl::unordered_dense for its exceptional speed—often matching or exceeding libraries like Abseil's flat_hash_map—and its low memory footprint, all while maintaining a familiar API and supporting modern C++ features like custom allocators and heterogeneous lookups.
A fast & densely stored hashmap and hashset based on robin-hood backward shift deletion
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Benchmarks show it consistently outperforms std::unordered_map, with iteration speeds matching a std::vector due to contiguous storage, making it ideal for data-intensive applications.
Elements are stored in a std::vector, drastically reducing cache misses during lookups and iterations, which is highlighted as a key design advantage over standard hash tables.
Supports high-quality avalanching hashes via wyhash, heterogeneous lookups with is_transparent, and customizable container types for integration with systems like boost::interprocess.
Fully compatible with C++17+, includes polymorphic allocator (PMR) typedefs, and offers C++20 module support for cleaner compilation in modern codebases.
The README admits deletions are relatively slow due to requiring two lookups—one to find the element and another to update the moved element—which can bottleneck certain workloads.
Iterators and references are invalidated on insert or erase, breaking code that relies on stable pointers, a trade-off explicitly noted in the design philosophy.
Does not provide const Key in std::pair<Key, Value>, which can cause issues in template-heavy code expecting standard-compliant types, as mentioned in the overview.
Features like custom bucket types or segmented variants require deeper understanding of internal mechanics, adding setup overhead compared to simpler drop-in libraries.