[cfe-dev] Measuring compilation performance
Robert Dailey via cfe-dev
cfe-dev at lists.llvm.org
Thu Jan 10 08:26:38 PST 2019
Thanks for the advice. Last time I used IWYU, it created more problems
than it solved. It doesn't quite work very well for large code bases.
I guess you could technically perform a per-header-file analysis even
after the preprocessor has gone through files, by keeping track of the
"markers" where that code is concatenated for the actual compile. But
this would be introspection only available to Clang itself I guess,
which would mean a new clang feature.
On Thu, Jan 10, 2019 at 9:35 AM Jonas Toth <development at jonas-toth.eu> wrote:
> 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
> 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