C++ Costless Abstractions: the compiler view
summary
Shows concrete compiler behavior using Clang++/LLVM bitcode and small C++ snippets: constexpr Fibonacci costs about 1s compile vs 3ms run because the compiler interprets templates at compile time; inlining and constant folding remove layers; passing by reference emits loads/stores while pass-by-value avoids memory traffic; static/anonymous linkage enables aggressive optimization; lambdas lower to returned closure state; copy elision and builtin memcpy replace obvious copies; std::vector initialized at startup runs code before main; noexcept/no unwind and devirtualization change call overhead.
AI-written summary · about
chapters (13)
- 0:00Introduction and motivation
- 6:29Compiler basics and disclaimers
- 7:35Functions and abstractions
- 10:43Inlining control and hints
- 16:42Tag dispatching and lambdas
- 20:53Data boxing and unboxing
- 24:10Member functions and copy elision
- 27:40Virtual methods and performance
- 30:01Controversial STL features
- 36:22Memory management and exceptions
- 39:35Vectorization and HPC
- 40:42Compiler communication and flags
- 42:26Q&A and closing remarks
related talks
57mFast and Small - What are the Costs of Language Features
47mReducing Template Compilation Overhead, Using C++11, 14, 17, and 20.
01h 04mconstexpr: Introduction
51mModern techniques for keeping your code dry
54mCost of Abstractions in Embedded Systems
26mWhen C++ Zero-Cost Abstraction fails: how-to Fix Your Compiler
59mModern C++ for Fun and Profit: This isn’t your old C++
01h 06m“C++ Metaprogramming: Journey from simple to insanity and back"
