CppCon 2019: Chandler Carruth “There Are No Zero-cost Abstractions”

Channel:CppCon · Length:59:52 · Published:2019-10-07 · Views:147225

Watch on YouTube

Summary

Chandler Carruth argues in a CppCon 2019 talk that C++ has no truly zero-cost abstractions. Using examples like unique_ptr, ABI constraints and compile-time costs, he shows that abstractions cost runtime, compile time or human effort.

Why HN recommends it

HN commenters cite it whenever zero-cost abstraction claims come up, especially for why unique_ptr is not free on some ABIs.

Chandler presents his point clearly and goes deep enough into the subject. — HN, 2022

C, C++, Rust, Go & systems languages · Software performance & optimization

Subtitles (excerpt)

so I'm Chandler Carruth I work at Google on C++ and LLVM and compilers and and I'm here to give a talk today because I feel bad actually I think I've been at CB peak on in the past and I've talked about zero cost abstractions now maybe even advocated that you all should use zero cost abstractions these are good things and that C++ is great because it gives them to us but today I'm here to kind of apologize and say that I was wrong a lot of other people were wrong and in fact there are no zero cost abstractions and imagining that there are is causing us serious problems and so that's that's gonna be the theme of this talk is what interactions have cost what problems does that cause for us and how do we want to cope with that reality so with that let's start getting going here by thinking a little bit about what abstractions we really care about in C++ what do we mean when we talk about abstractions in C++ code we'll start with the very simple the very fundamental abstractions the easy to use hammer that you know doesn't take a lot of work but it's probably more effective than trying to like push a nail in with your hand right still it's useful we have functions right functions work pretty well as

On Hacker News

Yes, tech talks don't need to be boring and I agree on many points on the post. But also not just 12 slides, more like hundreds of slides. One example I have is Chandler Carruths talk in CppCon 2019 "There Are No Zero-cost Abstrations" [VIDEO] Chandler presents his point clearly and goes deep enough into the subject. — metalrain, 2022-03
When it comes to the overhead issues of unique_ptr, I always think of this video here: [VIDEO] At 26:50 he gets into how this relates to ABI, and how 'fixing' some of this would require a pretty severe ABI change, as well as destructive move semantics, which would require a severe change to how C++ works. I frankly don't understand C++ well enough to fully judge about all of this, but everything … — TwentyPosts, 2023-07
> std::unique_ptr<Foo> doesn't have any overhead over Foo* in code where semantics is the same Not true. And you just refuted yourself by being up the ABI question. You should watch Titus Winters' presentation on this topic where he compiles code using unique_ptr and raw pointers, compares the assembler produced, and explains why unique_ptr has non-zero overhead. The overhead is indeed coming fro… — kccqzy, 2022-09
There are no zero cost abstractions. (According to Chandler Carruth, and he makes a convincing point). [VIDEO] — CountHackulus, 2021-08
The other time that you saw it was also probably me. It's from this talk, which is about how a large amount of generated protocol buffer code at Google led to a quadratic increase in compile times: [VIDEO] . TL;DW: The reasoning is because if you use a distributed build system, then your compile time is gated by the file with the longest compile time (tail latency). The more files you have, the g… — tylerhou, 2020-10

Related videos