On Wednesday 27 September 2006 11:11, "Hemmann, Volker Armin" 
<[EMAIL PROTECTED]> wrote about 'Re: [gentoo-amd64] 
First Impressions':
> -O3 don't do it. O2 is much, much safer and not really slower. It will
> prevent a lot of breakage.

Bah!

-O3 breaking just doesn't happen anymore.  I'm been running it for years.  
In fact -O3 has never generated invalid code [1] on x86 or amd64 
platforms.  It did for a period of time on ppc, but I think that was like 
10 years ago.

Also, some applications break with just -O2.  I count 8 ebuilds that 
replace this cflag specifically, there could be others that filter it or 
filter/replace optimization options entirely.  My methodology is available 
on request.

Now, it is an open question whether -O3 is significantly faster than -O2 
and depending on a number of factors it may actually be slower.  -O3 will 
enlarge code to make execution paths shorter, but a cache miss is probably 
goes to blow away any advantage gained.  Conversely, -Os will make 
execution paths longer to shrink code, and a cache hits may make up for 
the longer path. [2]

So, which is best depends on the program and on the CPU used (not only 
instruction set, but also cache sizes).  Therefore, making a sweeping 
recommendations is not recommended, but that doesn't stop anyone.  My 
recommendation is -O3. :)

Naturally, Gentoo wins over binary distros on this point, since you can use 
CFLAGS that are appropriate for your specific processor (including cflags 
which control the optimization tradeoff parameters) as well as tuning for 
the specific application.

-- 
"If there's one thing we've established over the years,
it's that the vast majority of our users don't have the slightest
clue what's best for them in terms of package stability."
-- Gentoo Developer Ciaran McCreesh

[1] That doesn't mean there weren't programs that crashed when compiled 
under -O3, just that the deficiency was found to be with the program not 
the compiler.

[2] But -Os may also break programs, and I've heard more problems on -Os 
than -O3 recently.  -Os had also had times when it generates invalid code.

Attachment: pgpkxoqnWp9Ns.pgp
Description: PGP signature

Reply via email to