Practical Techniques for Improving C++ Build Times
Slow builds block all C++ developers from the work being done. At Facebook we have a huge codebase, where the time spent compiling C++ sources grows significantly faster than the size of the repository. In this talk we will share our practical experience optimizing build times, in some cases from several hours to just a few minutes. The majority of the techniques are open sourced or generic and can be immediately applied to your codebase. Facebook strives to squeeze build speed out of everything: starting from a distributed build system, through the compiler toolchain and ending with code itself. We will dive into different strategies of calculating cache keys, potential caching traps and approaches to improve cache efficiency. We tune the compiler, specifically with compilation flags, profile data and link time options. We will talk about the benchmarks we use to track improvements and detect regressions and what challenges we face there. Finally, you will learn about our unsuccessful approaches with an explanation of why they didn't work out for us.