Improving C++ Compilation Times: Tools & Techniques
summary
Benchmarks show easy wins: use Ninja not make to cut seconds of build-system overhead (a SFML test drops make’s 6s overhead to ~1s), enable ccache to get ~35–50× apparent rebuild speed, and swap ld for clang’s lld or mold for large link speedups (lld shaved ~3s on an SFML build; mold can beat lld by orders of magnitude on Linux). Add PCH reuse (SFML full rebuild 34s→19s) and optional unity builds (~30% faster) but watch flags matching, anonymous-namespace/ODR and missing-include traps; use clang build analyzer to find hot headers and template instantiation hotspots.
AI-written summary · about
chapters (17)
- 0:00Introduction
- 1:26Why compilation times matter
- 7:49Root causes of slow compilation
- 12:00Optimizing build times flow
- 14:49Low-hanging fruits for builds
- 21:16Optimizing linker speed
- 25:56Compilation caches impact
- 30:52Hardware and OS tweaks
- 34:19Pre-compiled headers
- 44:19Unity builds
- 54:54Profiling bottlenecks
- 1:02:19Physical design improvements
- 1:14:35Third-party optimizations
- 1:23:23Call to action
- 1:32:37Summary and checklist
- 1:34:26Extern templates
- 1:43:09Q&A
related talks
53mReducing C++ Compilation Times Through Good Design
56mPractical Techniques for Improving C++ Build Times
59mThe Hitchhikers guide to faster builds
57mC++ MythBusters Strike 2
53mWhy Is My C++ Build So Slow? Compilation Profiling and Visualization
01h 08mC++ MythBusters Strike 2
10mStay in tune with your build using Build Insights
38mStrategies to speed up build iteration, or dynamic hot reloading
