This is the mail archive of the gcc@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: GCC 3.3 compile speed regression


> There's a closely related problem which I've hit every time I try to 
> debug a 'blow-up' in compilation time, and I believe this is the true 
> source of slowdowns at -O0.  A lot of stuff is being computed -- *even 
> at -O0* -- which is only used for optimization passes.  This is simply 
> wrong behavior.  Data which is only used for optimization should not be 
> computed at -O0, since it just gets thrown away anyway.

If I can contribute my uneducated suggestion, I must say that I think
you're pointing out a good spot here.

One evening I did try myself (with the little I know of the actual
compiler internals outside of ObjC) to track what the compiler was doing
when compiling 'int main (void) {return 0;}' with no optimization turned
on.

I was expecting it to generate a couple of tree nodes (maybe 5 or 10 - but
not more than 20), convert them into something else, and generate code.

But that's not the case.  I was shocked by the huge number of trees / rtls
/ data structures which are created in order to compile such a trivial
example with no optimizations.

I didn't have time to investigate more, and won't have time to do it, but
there must be something wrong there.

I'd expect a decent, fast compiler, when compiling such a tiny example
with all optimizations turned off, to generate a couple of tree nodes,
convert them to whatever other format, then generate code.

Maybe I'm just naive, but I think whatever the compiler is doing which is
causing that huge pile of trees/rtls/data to be generated (pre-generating
a lot of RTLs used in optimization passes which are never executed ?),
can't be right - or at least can't be _all_ right.

If I had the time, I'd use the following route to try speeding up the
compiler -

 1. start with compilation of 'int main (void) { return 0; }' with all
optimizations turned off.  Understand exactly what the compiler is doing
from start to end of compilation, why it's generating all that data (this
can't be right), and optimize away stuff until it is fast.

 2. add very small complications, first separate, then together.  A couple
of common optimizations to start with ?  A function call inside main() ?  
A few declarations ?  Understand what happens in all these cases, why the
compiler gets slower, and how much, compared with the basic case etc


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