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

CppNow · 34K views · 2013 · 1:33:02

Open on YouTube

C, C++, Rust, Go & systems languagesCompilers, interpreters & program analysisSoftware performance & optimizationtalk

Why Hacker News recommends it

HN lists it among C++ optimization talks and cites it for how much optimizer performance comes from inlining, from an experienced compiler engineer.

What it is

Chandler Carruth's CppNow 2013 keynote on how C++ builds complex software from simple emergent structures, and how compilers optimize them through inlining and value semantics.

Recommended by 1 HN commenters across 1 different months, 2013 to 2018.

What Hacker News said

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++" [this video] - "Efficiency with Algorithms" [LINK] 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.

Cites mihai_ionic · 2013-08 · on “Linus Torvalds - C++ is a horrible language”

> That said, avoiding libraries (especially avoiding templates and just using void*-like stuff) does keep binaries/libs smaller, but I'll gladly make the computer work slightly harder considering that the result is the same speed (C++ is often faster than C, in practice). This should not be an issue with modern C++ compilers. If two template instantiations generate the same or similar code, they will be merged and useless code is removed by dead code elimination. > The downside I care about is compilation speed. Simple C projects compile/link faster than modern C++ ones, even though the code for the same functionality is far more brittle, unsafe, and opaque At the same time, a lot of potenti

Cites dottrap · 2018-06 · on “One year of C”

I don't claim to have any answers, but I found all of this interesting and surprising. I wondered about a couple of things. What happens if the do_stuff_to_foo is actually defined (and what happens in that actual function)? And is there a difference between value semantics and pointer/reference semantics? These questions were my take-away from one of Chandler Carruth's C++ compiler optimization talks, I think it was this talk. [this video] My take aways were that the optimizer gets a huge chunk of its performance by inlining. And with value semantics, the optimizer can "cheat like crazy". So I defined two different variants for do_stuff_to_foo Original Pointer/Reference Semantics: void do_stuff_t