-O0 nearly twice as fast to build as -O2

Scott Ritchie scott at open-vote.org
Fri Jun 13 00:57:02 CDT 2008


Pavel Troller wrote:
>> OK, this was confusing.  I was getting repeatable five minute
>> builds, i.e. "make clean; reboot; time make -j3" (more or less :-)
>> was reliably showing five minutes wall clock time.
>>
>> Then I did "make distclean; ./configure; make depend".
>>
>> After that, I got repeatable nine minute builds, i.e.
>> make clean; reboot; time make -j3
>> was showing nine minute wall clock time.
>>
>> Turns out, the difference was... I had been building without
>> optimization.  So configuring with CFLAGS="-g -O0" is
>> almost a 2x speedup!
>>
> Hi!
>   Yes, you are right, turning optimization off speeds up the compilation
> substantially.
>   HOWEVER, it changes the generated code and due to various features of the
> compiler (like inlining or another) being present/absent, the code can,
> in rare cases, behave differently. I have many experiences that for example
> a program was repeatedly crashing, when compiled by default way, i.e. with
> optimalization, and when I compiled it without optimalization and with -g
> for debugging, it never crashed and worked perfectly under the debugger.
> I had to debug the optimized version, which is harder, because the generated
> code doesn't track the source exactly anymore.
>   With regards, Pavel Troller
> 
> 
Is that a GCC bug then?  And, more importantly, was that with a recent
GCC version?

Thanks,
Scott Ritchie



More information about the wine-devel mailing list