-O0 nearly twice as fast to build as -O2
patrol at sinus.cz
Fri Jun 13 00:43:31 CDT 2008
> 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!
Yes, you are right, turning optimization off speeds up the compilation
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
More information about the wine-devel