I tend to write rather large templated header-only C++ libraries and my users commonly complain about compilation times. After thinking about the matter, it occurred to me t
You can separate them out to some extent (I'm assuming make
)
-E
switch), and a .PHONY
target that depends on the preprocessor output files just like the normal binary target depends on .o
files. Measure how long it takes to build this target'PHONY
target that depends on all the .o
files but doesn't link them. Measure how long it takes to build this target (from clean)Now you have some idea how long it takes to pre-process, compile, and link. You can also compare optimized and non-optimized (-O0
) versions of the second and third target, to see how long is spent in the optimizer.