r/cpp • u/TheRavagerSw • Sep 13 '26
How I speed up my overall build times by 4x and incremental builds by 9x for test builds
I used faster tools:
- I switched from lld to mold optimized it mimalloc + pgo + lto + bolt (1.2x-3x faster than system lld)
- I optimized clang with mimalloc + pgo + lto + bolt (1.8x-1.85x faster than system clang)
- I optimized clang-scan-deps with mimalloc + pgo + lto + bolt (4x faster than system scanner)
- I used dynamic linking(3x-4x overall, much larger if you are editing tests)
- I used prebuilt binaries via packages rather than vendoring my deps.(huge)
- I switched fully to C++ modules(Incremental compilation times are so fast link times dominate now)