This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Suggestions for improving gcc 3.2 compilation speed?
> From: Anna Fowles-Winkler <awinkler at maad dot com>
>
> Hi Kaveh,
>
> Kaveh R. Ghazi wrote:
>
> > > --Anna
> > > PS - My application is mixed C/C++, and is compiled with the C++
> > > compiler. It has about 300K lines of code (400K+ including comments,
> > > blank lines), and links to Motif libraries, among other things.
> >
> >Would you please try one more thing? I'd like you to take your
> >largest file (or the one that takes the longest to compile) and run
> >before and after tests with --time-report, then post the results.
> >That will tell us where the compiler is spending it's time and also
> >zero in on gcc performance rather than "make" performance.
> >
> > Thanks,
> > --Kaveh
> >
> I'm doing a full compile when I do this, so I picked out the longest
> execution times for a few files to include here:
Hmm Can't see anything unusual about where time is going. These look
like all small files, i.e. 3-8 seconds to compile isn't a lot. I
assume you have lots of small files rather than a few large ones?
By the way, which are "before" times and which are "after" the patch?
> Execution times (seconds)
> cfg cleanup : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall
> life analysis : 0.04 ( 2%) usr 0.01 ( 3%) sys 0.03 ( 1%) wall
> life info update : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall
> preprocessing : 0.23 (10%) usr 0.09 (26%) sys 0.33 (11%) wall
> lexical analysis : 0.15 ( 7%) usr 0.10 (29%) sys 0.48 (16%) wall
> parser : 1.32 (58%) usr 0.13 (38%) sys 1.53 (52%) wall
> expand : 0.06 ( 3%) usr 0.00 ( 0%) sys 0.03 ( 1%) wall
> varconst : 0.09 ( 4%) usr 0.00 ( 0%) sys 0.09 ( 3%) wall
> integration : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall
> mode switching : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall
> local alloc : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> global alloc : 0.02 ( 1%) usr 0.00 ( 0%) sys 0.05 ( 2%) wall
> shorten branches : 0.02 ( 1%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> final : 0.03 ( 1%) usr 0.00 ( 0%) sys 0.05 ( 2%) wall
> symout : 0.23 (10%) usr 0.00 ( 0%) sys 0.28 (10%) wall
> rest of compilation : 0.04 ( 2%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> TOTAL : 2.27 0.34 2.94
>
> Execution times (seconds)
> life analysis : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall
> preprocessing : 0.30 (13%) usr 0.11 (25%) sys 0.27 ( 9%) wall
> lexical analysis : 0.26 (11%) usr 0.11 (25%) sys 0.38 (12%) wall
> parser : 1.32 (56%) usr 0.19 (43%) sys 1.86 (61%) wall
> expand : 0.02 ( 1%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> varconst : 0.06 ( 3%) usr 0.00 ( 0%) sys 0.12 ( 4%) wall
> integration : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall
> jump : 0.00 ( 0%) usr 0.01 ( 2%) sys 0.00 ( 0%) wall
> mode switching : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall
> local alloc : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> global alloc : 0.03 ( 1%) usr 0.00 ( 0%) sys 0.03 ( 1%) wall
> final : 0.04 ( 2%) usr 0.00 ( 0%) sys 0.03 ( 1%) wall
> symout : 0.30 (13%) usr 0.02 ( 5%) sys 0.30 (10%) wall
> rest of compilation : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> TOTAL : 2.37 0.44 3.03
>
> Execution times (seconds)
> cfg construction : 0.02 ( 1%) usr 0.00 ( 0%) sys 0.05 ( 2%) wall
> cfg cleanup : 0.04 ( 2%) usr 0.00 ( 0%) sys 0.03 ( 1%) wall
> life analysis : 0.11 ( 5%) usr 0.01 ( 4%) sys 0.14 ( 6%) wall
> life info update : 0.02 ( 1%) usr 0.01 ( 4%) sys 0.03 ( 1%) wall
> preprocessing : 0.12 ( 6%) usr 0.06 (21%) sys 0.22 ( 9%) wall
> lexical analysis : 0.09 ( 4%) usr 0.07 (25%) sys 0.05 ( 2%) wall
> parser : 0.71 (34%) usr 0.10 (36%) sys 1.02 (40%) wall
> expand : 0.09 ( 4%) usr 0.01 ( 4%) sys 0.17 ( 7%) wall
> varconst : 0.05 ( 2%) usr 0.00 ( 0%) sys 0.03 ( 1%) wall
> integration : 0.03 ( 1%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> jump : 0.03 ( 1%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> flow analysis : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.03 ( 1%) wall
> mode switching : 0.04 ( 2%) usr 0.00 ( 0%) sys 0.08 ( 3%) wall
> local alloc : 0.12 ( 6%) usr 0.00 ( 0%) sys 0.11 ( 4%) wall
> global alloc : 0.22 (11%) usr 0.00 ( 0%) sys 0.23 ( 9%) wall
> flow 2 : 0.02 ( 1%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> shorten branches : 0.02 ( 1%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> reg stack : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.03 ( 1%) wall
> final : 0.13 ( 6%) usr 0.01 ( 4%) sys 0.08 ( 3%) wall
> symout : 0.09 ( 4%) usr 0.01 ( 4%) sys 0.09 ( 4%) wall
> rest of compilation : 0.10 ( 5%) usr 0.00 ( 0%) sys 0.08 ( 3%) wall
> TOTAL : 2.06 0.28 2.53
>
> Execution times (seconds)
> cfg construction : 0.09 ( 1%) usr 0.00 ( 0%) sys 0.14 ( 2%) wall
> cfg cleanup : 0.09 ( 1%) usr 0.00 ( 0%) sys 0.11 ( 1%) wall
> life analysis : 0.42 ( 6%) usr 0.05 ( 8%) sys 0.47 ( 6%) wall
> life info update : 0.15 ( 2%) usr 0.02 ( 3%) sys 0.17 ( 2%) wall
> preprocessing : 0.31 ( 4%) usr 0.08 (13%) sys 0.36 ( 4%) wall
> lexical analysis : 0.21 ( 3%) usr 0.16 (25%) sys 0.48 ( 6%) wall
> parser : 2.05 (30%) usr 0.19 (30%) sys 2.25 (28%) wall
> expand : 0.59 ( 9%) usr 0.02 ( 3%) sys 0.56 ( 7%) wall
> varconst : 0.10 ( 1%) usr 0.01 ( 2%) sys 0.12 ( 2%) wall
> integration : 0.05 ( 1%) usr 0.00 ( 0%) sys 0.08 ( 1%) wall
> jump : 0.08 ( 1%) usr 0.01 ( 2%) sys 0.08 ( 1%) wall
> flow analysis : 0.06 ( 1%) usr 0.00 ( 0%) sys 0.03 ( 0%) wall
> mode switching : 0.20 ( 3%) usr 0.00 ( 0%) sys 0.16 ( 2%) wall
> local alloc : 0.44 ( 6%) usr 0.01 ( 2%) sys 0.52 ( 6%) wall
> global alloc : 0.95 (14%) usr 0.02 ( 3%) sys 1.05 (13%) wall
> flow 2 : 0.02 ( 0%) usr 0.00 ( 0%) sys 0.02 ( 0%) wall
> shorten branches : 0.08 ( 1%) usr 0.00 ( 0%) sys 0.20 ( 3%) wall
> reg stack : 0.02 ( 0%) usr 0.00 ( 0%) sys 0.03 ( 0%) wall
> final : 0.33 ( 5%) usr 0.05 ( 8%) sys 0.52 ( 6%) wall
> symout : 0.34 ( 5%) usr 0.01 ( 2%) sys 0.30 ( 4%) wall
> rest of compilation : 0.31 ( 4%) usr 0.00 ( 0%) sys 0.30 ( 4%) wall
> TOTAL : 6.89 0.63 8.00
>
> Execution times (seconds)
> cfg construction : 0.23 ( 3%) usr 0.02 ( 4%) sys 0.28 ( 3%) wall
> cfg cleanup : 0.84 (12%) usr 0.00 ( 0%) sys 0.95 (12%) wall
> life analysis : 0.50 ( 7%) usr 0.07 (12%) sys 0.52 ( 6%) wall
> life info update : 0.16 ( 2%) usr 0.02 ( 4%) sys 0.23 ( 3%) wall
> preprocessing : 0.26 ( 4%) usr 0.05 ( 9%) sys 0.36 ( 4%) wall
> lexical analysis : 0.17 ( 2%) usr 0.15 (27%) sys 0.41 ( 5%) wall
> parser : 1.48 (21%) usr 0.19 (34%) sys 1.70 (21%) wall
> expand : 0.46 ( 6%) usr 0.00 ( 0%) sys 0.44 ( 5%) wall
> varconst : 0.09 ( 1%) usr 0.00 ( 0%) sys 0.05 ( 1%) wall
> integration : 0.05 ( 1%) usr 0.00 ( 0%) sys 0.05 ( 1%) wall
> jump : 0.13 ( 2%) usr 0.01 ( 2%) sys 0.08 ( 1%) wall
> flow analysis : 0.05 ( 1%) usr 0.00 ( 0%) sys 0.05 ( 1%) wall
> mode switching : 0.15 ( 2%) usr 0.00 ( 0%) sys 0.17 ( 2%) wall
> local alloc : 0.49 ( 7%) usr 0.01 ( 2%) sys 0.45 ( 6%) wall
> global alloc : 0.96 (13%) usr 0.01 ( 2%) sys 1.08 (13%) wall
> shorten branches : 0.10 ( 1%) usr 0.00 ( 0%) sys 0.12 ( 2%) wall
> reg stack : 0.14 ( 2%) usr 0.00 ( 0%) sys 0.22 ( 3%) wall
> final : 0.35 ( 5%) usr 0.01 ( 2%) sys 0.33 ( 4%) wall
> symout : 0.21 ( 3%) usr 0.00 ( 0%) sys 0.22 ( 3%) wall
> rest of compilation : 0.37 ( 5%) usr 0.02 ( 4%) sys 0.42 ( 5%) wall
> TOTAL : 7.19 0.56 8.14
>
> Execution times (seconds)
> cfg construction : 0.00 ( 0%) usr 0.01 ( 3%) sys 0.05 ( 2%) wall
> life analysis : 0.05 ( 2%) usr 0.00 ( 0%) sys 0.05 ( 2%) wall
> life info update : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> preprocessing : 0.16 ( 7%) usr 0.04 (11%) sys 0.30 (11%) wall
> lexical analysis : 0.11 ( 5%) usr 0.14 (37%) sys 0.36 (13%) wall
> parser : 1.11 (52%) usr 0.17 (45%) sys 1.20 (45%) wall
> expand : 0.10 ( 5%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> varconst : 0.06 ( 3%) usr 0.00 ( 0%) sys 0.09 ( 3%) wall
> jump : 0.02 ( 1%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> mode switching : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.03 ( 1%) wall
> local alloc : 0.03 ( 1%) usr 0.01 ( 3%) sys 0.03 ( 1%) wall
> global alloc : 0.04 ( 2%) usr 0.00 ( 0%) sys 0.09 ( 3%) wall
> shorten branches : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> reg stack : 0.03 ( 1%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall
> final : 0.08 ( 4%) usr 0.00 ( 0%) sys 0.08 ( 3%) wall
> symout : 0.23 (11%) usr 0.01 ( 3%) sys 0.25 ( 9%) wall
> rest of compilation : 0.09 ( 4%) usr 0.00 ( 0%) sys 0.08 ( 3%) wall
> TOTAL : 2.14 0.38 2.69
>
> Execution times (seconds)
> cfg construction : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> life analysis : 0.02 ( 1%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> preprocessing : 0.21 (10%) usr 0.06 (16%) sys 0.38 (14%) wall
> lexical analysis : 0.11 ( 5%) usr 0.12 (32%) sys 0.30 (11%) wall
> parser : 1.28 (60%) usr 0.17 (45%) sys 1.39 (52%) wall
> expand : 0.03 ( 1%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall
> varconst : 0.05 ( 2%) usr 0.00 ( 0%) sys 0.08 ( 3%) wall
> jump : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall
> mode switching : 0.01 ( 0%) usr 0.01 ( 3%) sys 0.00 ( 0%) wall
> local alloc : 0.04 ( 2%) usr 0.00 ( 0%) sys 0.05 ( 2%) wall
> global alloc : 0.05 ( 2%) usr 0.00 ( 0%) sys 0.03 ( 1%) wall
> flow 2 : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall
> shorten branches : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> reg stack : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> final : 0.03 ( 1%) usr 0.00 ( 0%) sys 0.05 ( 2%) wall
> symout : 0.26 (12%) usr 0.02 ( 5%) sys 0.31 (12%) wall
> rest of compilation : 0.02 ( 1%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> TOTAL : 2.14 0.38 2.66
>
> Execution times (seconds)
> cfg construction : 0.01 ( 0%) usr 0.01 ( 3%) sys 0.00 ( 0%) wall
> cfg cleanup : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall
> life analysis : 0.05 ( 2%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> life info update : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> preprocessing : 0.15 ( 7%) usr 0.11 (30%) sys 0.34 (12%) wall
> lexical analysis : 0.17 ( 7%) usr 0.11 (30%) sys 0.34 (12%) wall
> parser : 1.27 (56%) usr 0.11 (30%) sys 1.34 (47%) wall
> expand : 0.04 ( 2%) usr 0.00 ( 0%) sys 0.05 ( 2%) wall
> varconst : 0.13 ( 6%) usr 0.00 ( 0%) sys 0.12 ( 4%) wall
> jump : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall
> flow analysis : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> mode switching : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall
> local alloc : 0.02 ( 1%) usr 0.01 ( 3%) sys 0.02 ( 1%) wall
> global alloc : 0.09 ( 4%) usr 0.00 ( 0%) sys 0.08 ( 3%) wall
> flow 2 : 0.02 ( 1%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall
> shorten branches : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.03 ( 1%) wall
> reg stack : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> final : 0.02 ( 1%) usr 0.00 ( 0%) sys 0.06 ( 2%) wall
> symout : 0.23 (10%) usr 0.02 ( 5%) sys 0.33 (12%) wall
> rest of compilation : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.05 ( 2%) wall
> TOTAL : 2.28 0.37 2.84
>
> Execution times (seconds)
> life analysis : 0.04 ( 2%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> life info update : 0.02 ( 1%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall
> preprocessing : 0.21 ( 9%) usr 0.03 ( 9%) sys 0.23 ( 8%) wall
> lexical analysis : 0.19 ( 8%) usr 0.12 (36%) sys 0.36 (12%) wall
> parser : 1.18 (52%) usr 0.17 (52%) sys 1.58 (52%) wall
> expand : 0.06 ( 3%) usr 0.00 ( 0%) sys 0.09 ( 3%) wall
> varconst : 0.08 ( 4%) usr 0.00 ( 0%) sys 0.05 ( 2%) wall
> jump : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> mode switching : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.03 ( 1%) wall
> local alloc : 0.03 ( 1%) usr 0.00 ( 0%) sys 0.06 ( 2%) wall
> global alloc : 0.08 ( 4%) usr 0.00 ( 0%) sys 0.11 ( 4%) wall
> shorten branches : 0.03 ( 1%) usr 0.00 ( 0%) sys 0.03 ( 1%) wall
> reg stack : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.02 ( 1%) wall
> final : 0.04 ( 2%) usr 0.00 ( 0%) sys 0.03 ( 1%) wall
> symout : 0.24 (11%) usr 0.00 ( 0%) sys 0.25 ( 8%) wall
> rest of compilation : 0.04 ( 2%) usr 0.00 ( 0%) sys 0.16 ( 5%) wall
> TOTAL : 2.26 0.33 3.05
>
> Also, I compile with these options:
>
> g++ -g -pedantic -Wall
>
> Thanks again!
> Anna