Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. C/C++
  3. unordered_dense

unordered_dense

MITC++v4.8.1

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.

GitHubGitHub
1.4k stars104 forks0 contributors

What is unordered_dense?

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.

Target Audience

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.

Value Proposition

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.

Overview

A fast & densely stored hashmap and hashset based on robin-hood backward shift deletion

Use Cases

Best For

  • Replacing std::unordered_map/set in performance-critical codebases
  • Applications requiring fast iteration over hash table elements
  • Scenarios where cache locality and data contiguity are important
  • Projects needing lower memory usage than standard hash containers
  • Implementing custom allocators or using polymorphic allocators (PMR)
  • Situations where iterator stability is less critical than raw speed

Not Ideal For

  • Codebases requiring stable iterators or references across insertions and erasures
  • Applications where deletion operations are frequent and performance-critical
  • Projects tightly coupled to the exact API guarantees of std::unordered_map (e.g., const Key in std::pair)
  • Embedded systems with severe memory fragmentation concerns, as segmented variants trade contiguity for lower peaks

Pros & Cons

Pros

Blazing Fast Performance

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.

Superior Cache Locality

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.

Advanced Customization Options

Supports high-quality avalanching hashes via wyhash, heterogeneous lookups with is_transparent, and customizable container types for integration with systems like boost::interprocess.

Modern C++ Feature Support

Fully compatible with C++17+, includes polymorphic allocator (PMR) typedefs, and offers C++20 module support for cleaner compilation in modern codebases.

Cons

Slow Deletion Speed

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.

Iterator Instability on Mutations

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.

Deviations from STL Conventions

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.

Increased Configuration Complexity

Features like custom bucket types or segmented variants require deeper understanding of internal mechanics, adding setup overhead compared to simpler drop-in libraries.

Frequently Asked Questions

Quick Stats

Stars1,406
Forks104
Contributors0
Open Issues8
Last commit4 months ago
CreatedSince 2022

Tags

#hash-tables#hash#stl-containers#high-performance#cpp17#data-structures#c-plus-plus#memory-efficient#stl-alternative#header-only-library#hashmap#no-dependencies#robin-hood-hashing#c-plus-plus-17#cpp

Built With

C
CMake
C
C++

Included in

C/C++70.6k
Auto-fetched 13 hours ago

Related Projects

Parallel HashmapParallel Hashmap

A family of header-only, very fast and memory-friendly hashmap and btree containers.

Stars3,190
Forks308
Last commit3 days ago
CRoaringCRoaring

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

Stars1,838
Forks322
Last commit3 days ago
robin-hood-hashingrobin-hood-hashing

Fast & memory efficient hashtable based on robin hood hashing for C++11/14/17/20

Stars1,613
Forks155
Last commit3 years ago
robin-maprobin-map

C++ implementation of a fast hash map and hash set using robin hood hashing

Stars1,483
Forks142
Last commit1 day ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub