HackerTube
HomeLongsLikedHistoryWatch laterCategoriesPlaylistsSettings

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
YouTube
63K views · 8 years ago · talk · evergreen

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.

Software performance & optimizationAlgorithms & data structuresC, C++, Rust, Go & systems languages#c++#hashtables#unordered_map#datastructures#performance

4 comments from Hacker News

@ww5202024 · in “1BRC Coding Challenge: Nerd Sniping the Java Community”

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

RecommendsView on HN
@JacksonAllan2023 · in “Factor is faster than Zig”

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,

CitesView on HN
@MauranKilom2021 · in “JSON for Modern C++ version 3.10.0”

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.

RecommendsView on HN
@MauranKilom2021 · in “JSON for Modern C++ version 3.10.0”

> 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 .

CitesView on HN
CppCon 2014: Chandler Carruth "Efficiency with Algorithms, Performance with Data Structures"1:13:41

CppCon 2014: Chandler Carruth "Efficiency with Algorithms, Performance with Data Structures"

CppCon
235K views • 12 years ago
CppCon 2017: Matt Kulukundis “Designing a Fast, Efficient, Cache-friendly Hash Table, Step by Step”59:34

CppCon 2017: Matt Kulukundis “Designing a Fast, Efficient, Cache-friendly Hash Table, Step by Step”

CppCon
137K views • 9 years ago
Abseil's Open Source Hashtables: 2 Years In - Matt Kulukundis - CppCon 201954:01

Abseil's Open Source Hashtables: 2 Years In - Matt Kulukundis - CppCon 2019

CppCon
22K views • 7 years ago
Advanced Topics in Programming Languages: A Lock-Free Hash Table58:36

Advanced Topics in Programming Languages: A Lock-Free Hash Table

GoogleTalksArchive
29K views • 14 years ago
CppCon 2016: Nicholas Ormrod “The strange details of std::string at Facebook"31:19

CppCon 2016: Nicholas Ormrod “The strange details of std::string at Facebook"

CppCon
122K views • 10 years ago
CppCon 2016: Chandler Carruth “High Performance Code 201: Hybrid Data Structures"55:49

CppCon 2016: Chandler Carruth “High Performance Code 201: Hybrid Data Structures"

CppCon
119K views • 10 years ago
Can C++ be 10x Simpler & Safer?  - Herb Sutter - CppCon 20221:54:00

Can C++ be 10x Simpler & Safer? - Herb Sutter - CppCon 2022

CppCon
277K views • 3 years ago
CppCon 2015: Sean Parent "Better Code: Data Structures"1:04:00

CppCon 2015: Sean Parent "Better Code: Data Structures"

CppCon
106K views • 11 years ago
Sorting Algorithms: Speed Is Found In The Minds of People - Andrei Alexandrescu - CppCon 20191:29:55

Sorting Algorithms: Speed Is Found In The Minds of People - Andrei Alexandrescu - CppCon 2019

CppCon
184K views • 7 years ago
C++ Seasoning1:17:12

C++ Seasoning

aghuttun
58K views • 13 years ago
Rust at speed — building a fast concurrent database52:54

Rust at speed — building a fast concurrent database

Jon Gjengset
225K views • 7 years ago
2013 Keynote: Chandler Carruth: Optimizing the Emergent Structures of C++1:33:02

2013 Keynote: Chandler Carruth: Optimizing the Emergent Structures of C++

CppNow
34K views • 13 years ago
Stephan T. Lavavej “Floating-Point <charconv>: Making Your Code 10x Faster With C++17's Final Boss”1:00:17

Stephan T. Lavavej “Floating-Point <charconv>: Making Your Code 10x Faster With C++17's Final Boss”

CppCon
41K views • 7 years ago
CppCon 2014: Mike Acton "Data-Oriented Design and C++"1:27:46

CppCon 2014: Mike Acton "Data-Oriented Design and C++"

CppCon
862K views • 12 years ago
CppCon 2016: Herb Sutter “Leak-Freedom in C++... By Default.”1:39:25

CppCon 2016: Herb Sutter “Leak-Freedom in C++... By Default.”

CppCon
149K views • 10 years ago
High-performance Tree Wrangling, the APL Way // Aaron Hsu // Dyalog '1830:37

High-performance Tree Wrangling, the APL Way // Aaron Hsu // Dyalog '18

Dyalog User Meetings
6K views • 7 years ago
"Compacting the Uncompactable" by Bobby Powers40:18

"Compacting the Uncompactable" by Bobby Powers

Strange Loop Conference
29K views • 7 years ago
CppCon 2018: G. Nishanov “Nano-coroutines to the Rescue! (Using Coroutines TS, of Course)”1:04:26

CppCon 2018: G. Nishanov “Nano-coroutines to the Rescue! (Using Coroutines TS, of Course)”

CppCon
40K views • 8 years ago
C++ and Beyond 2012: Herb Sutter - atomic Weapons 1 of 21:21:13

C++ and Beyond 2012: Herb Sutter - atomic Weapons 1 of 2

alexsmail
71K views • 9 years ago
"Outperforming Imperative with Pure Functional Languages" by Richard Feldman34:55

"Outperforming Imperative with Pure Functional Languages" by Richard Feldman

Strange Loop Conference
98K views • 5 years ago