[cfe-dev] Measuring compilation performance

Jonas Toth via cfe-dev cfe-dev at lists.llvm.org
Thu Jan 10 07:35:54 PST 2019


If you use ninja it has a build log detailing how long each translation
took. (see this: https://github.com/nico/ninjatracing)
Your header requests are not resolveable, because of the copy-paste +
Preprocessor semantics of headers. Thats why C++ is getting modules. The
data is only available for translation units.

Consider using `include-what-you-use` as well, helping with the
include-problems.

Best, Jonas

Am 10.01.19 um 16:05 schrieb Robert Dailey via cfe-dev:
> I am experiencing, in general, very slow build times. However, I don't
> see a way to measure on a per-file basis, the amount of time the
> compiler spends compiling code. I think it would be useful to see
> statistics on how many times a header file is compiled (collectively,
> across all translation units) as well as per-file (H and CPP) how much
> time is spent compiling code. This would allow me to find header files
> included too often, and possibly fix it by removing includes, forward
> declarations, pimpl idiom, etc. Time spent per-file would be nice to
> know if, for example, the way I've implemented a template class is
> causing long compile times and refactor it to be faster.
>
> Right now I just don't have a way to do this. Are these metrics
> inherently provided by clang? And if not, are there external tools to
> help diagnose slow compilation? Advice is greatly appreciated.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list