For my tests I need to compile some thousand C++ files which have a lot of code in common. Because not all compilers are conformant (or more permissive) I execute all my tests with g++, clang++ and msvc on windows and linux.
To improve compile times I use already precompiled headers for common code. Additionally I wrote a small preprocessor app to allow "unity builds" (combine *.cpp files into a single *.cpp file).
Currently I get the following compile times (random test case):
(approx 10 times)
(approx 1.4 times)
(approx 1.9 times)
Unfortunately my code contains a lot of templates / template instantiations which seem to be only "saved" in the Microsoft PCH.
Do you know any way to get similar compile times for g++ and clang++? Do you have any suggestion how to improve my compile times?
Here you can see the chrome/clang trace (-ftime-trace and pch):
I see at least in the current clang trunk that there is some notable progress to improve compile times in combination with templates and precompiled headers / modules.
Perhaps gcc implements something similar - we will see. But thanks for your comments.