Why Is My C++ Build So Slow? Compilation Profiling and Visualization
Talkat CppCon 2024 · on Thursday, 2024-09-19· at 14:00· Adams A, 6700 North Gaylord Rockies Boulevard·
summary
Build slowness turns on specifics: Clang’s -ftime-trace produces per-object JSON showing front-end vs back-end time, Ninja emits a ninja log that ninja tracing converts into Chrome trace format, and perfetto lets SQL queries answer “how much time does iostream or boost cost us.” Example hotspots: iostream inflates a simple file to ~3MB of preprocessed text, huge template instantiations can generate ~33,000 lines, and precompiled headers can hurt parallelism (1.91s → 1.16s when used right, but sometimes slower because of blocking).
AI-written summary · about
chapters (14)
- 0:00Build speed motivation
- 1:49Speaker overview
- 10:20Visualizing with Ninja and clang
- 11:44Includes and headers
- 16:01Templates and metaprogramming
- 20:15Translation units and dependencies
- 23:05Precompiled headers and modules
- 27:21Dependency bottlenecks
- 29:31Include paths overhead
- 32:20Advanced profiling with perfetto
- 33:47Optimizing build process
- 35:53Hardware limits
- 38:22Takeaways and call to action
- 39:25Q&A
related talks
59mThe Hitchhikers guide to faster builds
53mReducing C++ Compilation Times Through Good Design
01h 44mImproving C++ Compilation Times: Tools & Techniques
05mHow To Profile Compilation Duration?
56mPractical Techniques for Improving C++ Build Times
01h 00mThe Hitchhiker's Guide to Faster Builds
06mLightning Talk: C++ Debug Performance is Improving: What Now?
29mOptimizing compilation times with Templates
