IncludeGuardian

IncludeGuardian is a free tool to help improve C and C++ build times. The most time consuming part of build times is usually not compiling or linking, but preprocessing and syntax checking files that have been #includeed. A simple "Hello World" application in C++ will be preprocessed to almost a 1MB file from only the #include <iostream> line. This is all run through the compiler and will take an additional 150ms. If a commonly used header in your application is particularly large, or includes a large number of other headers, this can add minutes to your build time if includes in hundreds source files.

IncludeGuardian makes recommendations for your project on how to reduce work the compiler needs to do. These suggestions include:

With each suggestion IncludeGuardian will give a percentage saving for the number of preprocessing tokens that need to be compiled. Although this is not a perfect substitute for the actual time saved, it is a reasonable alternative that will give a deterministic result in a fraction of the time.

See the instructions page on how to download and run IncludeGuardian.

For an example, see cmake_analysis.yaml for the output when running over the CMake project.