Talks to Watch

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

235K views · Oct 21, 2014 · 1:13:41 · 7 HN recommenders · 15 mentions · discussed 2014–2024

Chandler Carruth's CppCon 2014 talk on writing fast C++, explaining why data structure choice and memory layout matter more than clever algorithms. It covers why standard containers like unordered_map perform poorly on modern CPUs.

Why Hacker News points people here: A perennial recommendation for anyone learning performance optimization, cited whenever hash tables, cache behavior or STL containers come up.

“I'm also a big fan of "Efficiency with Algorithms, Performance with Data Structures" by Chandler Carruth at CppCon 2014.”HN comment, 2024

What Hacker News said 15

Strongly recommendsamaksDec 2014

“See the great talk on CppCon 2014 about those issues”

Covers inefficient standard library containers like unordered_map on modern CPUs

Full comment

There are many things in the standard C++ library which are named incorrectly (std::string), awkwardly (std::unordered_map) and and implemented inefficiently from the perspective of modern CPUs (same std::unordered_map, which uses linked list for the underlying hash table buckets). See the great talk on CppCon 2014 about those issues - this video .

in “Std::string half of all allocations in the Chrome browser process” · view on HN
Strongly recommendsslavik81Mar 2024

“I'm also a big fan of "Efficiency with Algorithms, Performance with Data Structures" by Chandler Carruth at CppCon 2014.”

Commenter is a big fan of this performance talk

Full comment

Strongly agree. That's perhaps less true for the software I work on these days (lapack), but I've seen that so many times over my career. I'm also a big fan of "Efficiency with Algorithms, Performance with Data Structures" by Chandler Carruth at CppCon 2014. this video

in “Ask HN: How can I learn about performance optimization?” · view on HN
RecommendsyoklovFeb 2015

“Chandler Carruth's CPPCon talk [0] this year was also great”

A great and actionable CppCon performance talk for most developers

Full comment

Chandler Carruth's CPPCon talk [0] this year was also great (surprisingly, as I had a fairly low opinion of most of the others). It wasn't better than Mike Acton's [1], but I suspect that it was more actionable for most devs. [0] this video [1] link

in “The Care and Feeding of C++'s Dragons (2013) [video]” · view on HN
RecommendssanderjdAug 2015

“I've just watched a couple cppcon talks ([0], [1]) and I'm feeling a bit drunk on the kool-aid.”

Talk that made the commenter rethink linked versus contiguous data structures

Full comment

Also, those allocations imply linked, rather than contiguous, data structures, which (often? always?) imply poor cache interaction, which is a major source of inefficiency. Would love some more perspectives on this, as I've just watched a couple cppcon talks ([0], [1]) and I'm feeling a bit drunk on the kool-aid. [0]: this video [1]: link

in “The Case for Controlled Side Effects” · view on HN
RecommendshumanrebarMay 2016

Listed among talks on C++ efficiency and performance

Full comment

Here's a few: - "Tuning C++: Benchmarks, and CPUs, and Compilers! Oh My!" link - "Understanding Compiler Optimization" link - "Optimizing the Emergent Structures of C++" link - "Efficiency with Algorithms" this video The first one is really good if you've never benchmarked anything in a Linux environment. Or if you otherwise want to learn how to investigate how C++ gets turned into machine code.

in “Why I don't spend time with Modern C++ anymore” · view on HN
RecommendsamaksMay 2016

“some data structures are just not fast on modern CPUs, so they have to be chosen wisely. Here is good talk”

Explains which data structures are slow on modern CPUs

Full comment

STL is not inherently slow per se, some data structures are just not fast on modern CPUs, so they have to be chosen wisely. Here is good talk: this video .

in “C++ for Games: Performance, Allocations and Data Locality” · view on HN
RecommendsadrianNJun 2017

“See for example this nice talk by Chandler Carruth”

Nice talk on carefulness with dictionaries in performance-sensitive code

Full comment

Yes, if you write performance sensitive code you have to be very careful with dictionaries. See for example this nice talk by Chandler Carruth this video

in “Diving into the world of hash tables” · view on HN
RecommendsalexhutchesonSep 2020

“you'd probably really enjoy Chandler Carruth's "Efficiency with Algorithms, Performance with Data Structures" talk from CppCon 2014”

Efficiency with algorithms and performance with data structures

Full comment

If you haven't already seen it, you'd probably really enjoy Chandler Carruth's "Efficiency with Algorithms, Performance with Data Structures" talk from CppCon 2014: this video

in “On modern hardware the min-max heap beats a binary heap” · view on HN
Cites itsanderjdSep 2015

Talk on STL data structures and why unordered_map uses buckets

Full comment

I'm pretty curious about this: have memory access patterns and cache awareness become more of a big deal in the past decade or so, or has it only recently reached my awareness? I studied CS in the early 2000s and while I was aware of various trade-offs between contiguous and linked data structures, it's only in the last few years that the importance of cache (and non-"system" languages' widespread flouting of its importance) has really bubbled up in my consciousness. It's certainly likely that I just didn't take the right kinds of classes, or that I did but just missed or failed to really internalize this, but I'm curious if something else is going on. Has the bottleneck increasingly become memory rather than CPU? Have we more thoroughly exhausted other areas of optimization? I was thinking about this while watching a talk[0] given by someone from Google about data structures in the STL, which decried that the standardized specification for `std::unordered_map` more or less forces an implementation to use buckets instead of the more cache-friendly technique of probing. I'm sure that the people who standardized it were very competent, which makes me think that, at least at the time, buckets were thought to be the better implementation. [0]: this video Edit: Added video link.

in “C++ vs. OCaml: Ray tracer comparison (2005)” · view on HN
Cites itsantaclausMay 2016

“This comes up in one of Chandler Carruth's talks [1].”

Discusses why unordered_map is forced into chaining

Full comment

I think C++'s built in unordered_map has to use chaining due to restrictions on iterators mandated for standard library containers, which is a drag. You've still got to roll your own open addressed container. :( This comes up in one of Chandler Carruth's talks [1]. [1] this video

in “C++ for Games: Performance, Allocations and Data Locality” · view on HN
Cites itadrianNMay 2016

“See for example what Chandler has to say about writing good code”

Chandler on writing good code that can be profiled

Full comment

Uniformly shitty code is hard to profile. See for example what Chandler has to say about writing good code this video

in “Searching 20 GB/sec: Systems Engineering Before Algorithms (2014)” · view on HN
Cites ittjalfiJun 2017

“Chandler Carruth talks about unordered_map performance[1] in his CppCon 2014 talk”

Covers unordered_map performance and endorses alternatives

Full comment

Chandler Carruth talks about unordered_map performance[1] in his CppCon 2014 talk "Efficiency with Algorithms, Performance with Data Structures". He endorses most of the other alternatives you mentioned. [1] this video

in “Diving into the world of hash tables” · view on HN
Cites itchilleeSep 2018

“C++ STL unordered_map is so much slower than it needs to be”

Shows STL unordered_map is slower than it needs to be

Full comment

Somewhat interestingly, C++ STL unordered_map is so much slower than it needs to be: this video Using one of the policy-based data structures instantly gets you about an order magnitude of speedup (for accesses).

Cites itinetknghtSep 2019

“In the talk he presented a table with (approximately) round-trip-times of various data layers.”

Presents a table of approximate round-trip times for data layers

Full comment

This talk seems to me to follow a similar line of thinking to the one I saw presented by Chandler Carruth at the 2014 C++ conference [0]. In the talk he presented a table with (approximately) round-trip-times of various data layers. [0]: this video

in “Designing far memory data structures: think outside the box” · view on HN
Cites italexhutchesonMar 2021

“See Chandler Carruth’s talk from CppCon 2014”

Supports point that scattered allocations cause cache misses

Full comment

But then your objects are scattered all over the address space, which means that objects you’re accessing in sequence are unlikely to be in the same cache line, so you pay a cache miss on every single access. Having (maybe?) more efficient malloc/free in exchange for dramatically increasing the cost of accessing your data is not a good trade-off for most access patterns. See Chandler Carruth’s talk from CppCon 2014: this video

in “Drop millions of allocations by using a linked list (2015)” · view on HN