This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Profiling compilation time


Yang Zhang <yanghatespam@gmail.com> writes:

> For me, -ftime-report shows that compilation time is by far dominated
> by parsing, so that's what I'm most interested in.  To that end, would
> a valid poor man's profiling approach be to simply measure the time of
> #including individual files into an otherwise empty source file?  Or
> would it be necessary to actually "trigger" the parsing somehow by
> using the headers' contents (particularly for templated entities)?

In my experience, when not optimizing, C++ compilation time is normally
dominated by parsing and name lookup.

As far as I know, your approach should give you a reasonable first
approximation.  Template code is fully parsed even if the template is
not instantiated.  Of course there is more work to do if the template is
instantiated, and that work is also counted against parsing time.  If
you are really interested, I think you could separate out template
expansion time by adding a new entry to gcc/timevar.def and using that
entry in instantiate_decl in gcc/cp/pt.c.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]