On 06/26/14 07:42, Teresa Johnson wrote:
The following patch fixes a big inefficiency when using -fdump-tree-all
for large source files. I found that when using this option the
compile time became unreasonably slow, and I traced this to the fact
that dump_begin/dump_end are called around every function/class that
are dumped via -fdump-tree-original and -fdump-class-hierarchy.
I fixed this by opening the .original and .class dumps once before
invoking the parser and closing them once after.

For a file containing ~7000 each of functions and classes, the real time
measured for the compile is:
   no dumping: 8s
   -fdump-tree-all, no patch: 10m30s
   -fdump-tree-all, my patch: 1m21s

Bootstrapped and tested on x86_64-unknown-linux-gnu. Ok for trunk?

Thanks,
Teresa

2014-06-26  Teresa Johnson  <tejohn...@google.com>

         * c-family/c-common.h (get_dump_info): Declare.
         * c-family/c-gimplify.c (c_genericize): Use saved dump files.
         * c-family/c-opts.c (c_common_parse_file): Begin and end dumps
         once around parsing invocation.
         (get_dump_info): New function.
         * cp/class.c (dump_class_hierarchy): Use saved dump files.
         (dump_vtable): Ditto.
         (dump_vtt): Ditto.
Marginally gross with the special casing of the TDI_original and TDI_class dump files. Ideally one day we'll have a better dumping API which would allow us to hold open files in a sensible way.

OK for the trunk.

jeff

Reply via email to