C++Now 2018: You Can Do Better than std::unordered_map: New Improvements to Hash Table Performance
CppNow2 HN recommenders · recommended in 2 months, 2021–2024
talk · advanced · evergreen · 2021–2024 on HN
Malte Skarupke's C++Now 2018 talk on hash table performance, explaining why std::unordered_map is slow and memory hungry and presenting faster designs, including his bytell hash map.
Recommended as a thorough, well-regarded explanation of hash table design tradeoffs and why the standard container is a poor choice.
Up next
16 mo on HNHow Python was Shaped by leaky Internals, Armin Ronacher, Flask framework
Видео с мероприятий {speach!
15 HN recommender · 2017–2025
11 mo on HNCppCon 2015: Andrei Alexandrescu “std::allocator...”
CppCon
7 HN recommender · 2017–2025
12 mo on HNPreventing the Collapse of Civilization / Jonathan Blow (Thekla, Inc)
DevGAMM
14 HN recommender · 2020–2025
10 mo on HN"Performance Matters" by Emery Berger
Strange Loop Conference
12 HN recommender · 2019–2025
11 mo on HNThe Thirty Million Line Problem
Molly Rocket
11 HN recommender · 2018–2024
10 mo on HNCppCon 2017: Matt Kulukundis “Designing a Fast, Efficient, Cache-friendly Hash Table, Step by Step”
CppCon
9 HN recommender · 2018–2026
10 mo on HNErlang Factory 2014 - That's 'Billion' with a 'B': Scaling to the Next Level at WhatsApp
Erlang Solutions
6 HN recommender · 2014–2022
9 mo on HNHow Crash Bandicoot Hacked The Original Playstation | War Stories | Ars Technica
Ars Technica
13 HN recommender · 2020–2026
9 mo on HN"How NOT to Measure Latency" by Gil Tene
Strange Loop Conference
9 HN recommender · 2015–2026
10 mo on HNRefterm Lecture Part 1 - Philosophies of Optimization
Molly Rocket
10 HN recommender · 2021–2026
9 mo on HNCppCon 2014: Mike Acton "Data-Oriented Design and C++"
CppCon
9 HN recommender · 2015–2026
8 mo on HNJonathan Blow - Preventing the Collapse of Civilization (English only)
bus
11 HN recommender · 2019–2023
4 comments from Hacker News
Many videos on hash table are great. I found this one particularly good. [ ▶ this video ] C++Now 2018: You Can Do Better than std::unordered_map: New Improvements to Hash Table Performance
It has the right asymptotic guarantees for a hash map, but beyond that it doesn't have much going for it. The degree to which it emphasizes pointer/iterator stability and arbitrary load factors is not a good tradeoff in almost any practical case (unless you do not care about performance). See ▶ this video for a more comprehensive discussion, or the sibling threads here.
In my example the table stores the hash codes themselves instead of the keys (because the hash function is invertible) Oh, I see, right. If determining the home bucket is trivial, then the back-shifting method is great. The issue is just that it’s not as much of a general-purpose solution as it may initially seem. In the bad cases, it's really bad. With a different algorithm (Robin Hood or bidirectional linear probing), the load factor can be kept well over 90% with good performance, as the benchmarks in the same repo demonstrate. I’ve seen the 90% claim made several times in literature on Robin Hood hash tables. In my experience, the claim is a bit exaggerated, although I suppose it depends on what our idea of “good performance” is. See these benchmarks, which again go up to a maximum load factor of 0.95 (although boost and Absl forcibly grow/rehash at 0.85-0.9): link Tsl, Martinus, and CC are all Robin Hood tables ( link , link , and link , respectively). Absl (from Google) and Boost are well-known C++ SIMD-based hash tables. Khash ( link ) is, I think, an ordinary open-addressing table using quadratic probing. Fastmap is a new, yet-to-be-published design that is fundamentally similar to bytell ( ▶ this video ) but also incorporates some aspects of the aforementioned SIMD maps (in particular, it stores a 4-bit fragment of the hash code to avoid most false key comparisons). As you can see, all the Robin Hood maps spike upwards dramatically as the load factor gets high,
> some kind of bucket-optimisation (multiple elements per allocation, instead of one element per allocation) should also meet all constraints the standard sets for this type Pretty sure that makes it impossible to implement merge without pointer/iterator invalidation, which is a constraint imposed by the standard ( link ). > it would be good if the person I originally responded to came out and defended his POV See link if you want numbers, or for example this talk by the same author ▶ this video .