On Wednesday 27 September 2006 22:59, Daniel Iliev <[EMAIL PROTECTED]> 
wrote about 'Re: [gentoo-amd64] First Impressions':
> Dan Pasanen wrote:
> > Ok, im not too sure about this, but i was wondering, i have dual core
> > turion64's should that affect if im running -O2 or -O3? currently im
> > running -O2.  and if i did change it to -O3, what, if anything should
> > i recompile?

Dual core or not won't affect your CFLAGS much.  Worry mostly about the 
size of your L1 cache, compared to processors of the same architecture 
being sold today.  If yours is fairly large, go with -O3; If undersized, 
go with -Os; Otherwise, -O2 will serve you well.

> I thing it is reasonable to doubt that a program compiled with
> "-O3" would greatly outperform the same program compiled with "-O2".

This is a reasonable doubt, for reasons already mentioned.

> The 
> same logic is applicable about stability. I have to admit that my logic
> here is a plain arithmetic of type: "1 lemon - 10 cents, 10 lemons - 100
> cents".

Well, optimization techniques are quite a bit more varied than lemons.

In particular, if you could only choose one optimization technique from the 
gcc info pages there is probably a "correct" choice that 90% of the gcc 
developers would agree on.  And guess what?  They probably put that one 
in -O1. :)

By the time you get to -O3, you are really just instructing the compiler on 
what tradeoffs to make. finline-functions and funswitch-loops are code 
size vs. execution path length tradeoffs and fgcse-after-reload is a [lots 
of] compilation time vs. [a little] (code size AND execution path length) 
tradeoff.

Again, the performance gained (or lost) from a given compiler optimization 
option can vary based on program and processor.  If you don't feel you can 
make a good decision based on reading the gcc info pages, don't include 
the option in your CFLAGS and just go with -O2 or -O3.

-- 
"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

Attachment: pgpCkymir915i.pgp
Description: PGP signature

Reply via email to