HackerTube.dev

C++Now 2018: You Can Do Better than std::unordered_map: New Improvements to Hash Table Performance

CppNow · 62.9K views · 2018-06-09 · 1:30:53

Open on YouTube ↗

If playback is restricted in your region, try opening the original video. Use Mark watched to add it to your marked videos.

Overview

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.

On Hacker News

Recommended as a thorough, well-regarded explanation of hash table design tradeoffs and why the standard container is a poor choice.

Recommended by 2 HN people across 2 months · HN mentions 2021–2024

Topics

Search by tags

What people said

ww520 · 2024-10 · Recommendation

Many videos on hash table are great. I found this one particularly good. [ [VIDEO] ] C++Now 2018: You Can Do Better than std::unordered_map: New Improvements to Hash Table Performance

Read the original HN comment ↗
MauranKilom · 2021-08 · Recommendation

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 [VIDEO] for a more comprehensive discussion, or the sibling threads here.

Read the original HN comment ↗
JacksonAllan · 2023-11 · Reference

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 ( [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,

Read the original HN comment ↗

Sources

Video by CppNow, played through YouTube.

Data and selection notes

HN summaries and labels may contain AI errors. HN dates refer to discussions, not video publication.

HN Library: HackerTube export (2026-10-31) and open-index/hacker-news. Upstream summaries and classifications may contain AI errors.

Views, duration and playback status refresh separately from the published catalog. When an update fails, existing data remains visible.

Selection checks
  • SaaS & AI candidates: Topic keywords do not match
  • Editor-approved picks: Editorial review is required

Rule matches identify candidates. They do not guarantee video quality or financial results.

About the library and its sources