CppCon 2014: Chandler Carruth "Efficiency with Algorithms, Performance with Data Structures"
Why Hacker News recommends it
A perennial recommendation for anyone learning performance optimization, cited whenever hash tables, cache behavior or STL containers come up.
What it is
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.
Recommended by 7 HN commenters across 7 different months, 2014 to 2024.
What Hacker News said
Strong rec amaks · 2014-12 · on “Std::string half of all allocations in the Chrome browser process”
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] .
Strong rec slavik81 · 2024-03 · on “Ask HN: How can I learn about performance optimization?”
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]
Recommends yoklov · 2015-02 · on “The Care and Feeding of C++'s Dragons (2013) [video]”
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]
Recommends sanderjd · 2015-08 · on “The Case for Controlled Side Effects”
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]
Recommends humanrebar · 2016-05 · on “Why I don't spend time with Modern C++ anymore”
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.
Recommends amaks · 2016-05 · on “C++ for Games: Performance, Allocations and Data Locality”
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] .
Recommends adrianN · 2017-06 · on “Diving into the world of hash tables”
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]
Recommends alexhutcheson · 2020-09 · on “On modern hardware the min-max heap beats a binary heap”
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]