1 |
On Wednesday 27 September 2006 22:59, Daniel Iliev <danny@××××××××.com> |
2 |
wrote about 'Re: [gentoo-amd64] First Impressions': |
3 |
> Dan Pasanen wrote: |
4 |
> > Ok, im not too sure about this, but i was wondering, i have dual core |
5 |
> > turion64's should that affect if im running -O2 or -O3? currently im |
6 |
> > running -O2. and if i did change it to -O3, what, if anything should |
7 |
> > i recompile? |
8 |
|
9 |
Dual core or not won't affect your CFLAGS much. Worry mostly about the |
10 |
size of your L1 cache, compared to processors of the same architecture |
11 |
being sold today. If yours is fairly large, go with -O3; If undersized, |
12 |
go with -Os; Otherwise, -O2 will serve you well. |
13 |
|
14 |
> I thing it is reasonable to doubt that a program compiled with |
15 |
> "-O3" would greatly outperform the same program compiled with "-O2". |
16 |
|
17 |
This is a reasonable doubt, for reasons already mentioned. |
18 |
|
19 |
> The |
20 |
> same logic is applicable about stability. I have to admit that my logic |
21 |
> here is a plain arithmetic of type: "1 lemon - 10 cents, 10 lemons - 100 |
22 |
> cents". |
23 |
|
24 |
Well, optimization techniques are quite a bit more varied than lemons. |
25 |
|
26 |
In particular, if you could only choose one optimization technique from the |
27 |
gcc info pages there is probably a "correct" choice that 90% of the gcc |
28 |
developers would agree on. And guess what? They probably put that one |
29 |
in -O1. :) |
30 |
|
31 |
By the time you get to -O3, you are really just instructing the compiler on |
32 |
what tradeoffs to make. finline-functions and funswitch-loops are code |
33 |
size vs. execution path length tradeoffs and fgcse-after-reload is a [lots |
34 |
of] compilation time vs. [a little] (code size AND execution path length) |
35 |
tradeoff. |
36 |
|
37 |
Again, the performance gained (or lost) from a given compiler optimization |
38 |
option can vary based on program and processor. If you don't feel you can |
39 |
make a good decision based on reading the gcc info pages, don't include |
40 |
the option in your CFLAGS and just go with -O2 or -O3. |
41 |
|
42 |
-- |
43 |
"If there's one thing we've established over the years, |
44 |
it's that the vast majority of our users don't have the slightest |
45 |
clue what's best for them in terms of package stability." |
46 |
-- Gentoo Developer Ciaran McCreesh |