[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Compiling packages for the standard distribution with -Os instead of -O2



Anthony DeRobertis wrote:
> On Wed, May 03, 2006 at 11:02:57AM -0300, Henrique de Moraes Holschuh wrote:
> 
> > For Etch and Sid, it is probably a good idea to use -Os instead of -O2 at
> > least on the bigger arches (ia32, ia64, amd64, etc), as we can probably
> > trust gcc not to screw up.
> 
> If gcc generally generates faster code with -Os than -O2, then isn't
> that a gcc bug,

It doesn't do so generally.

>in that the optimizations enabled by -O2 are incorrectly picked?

The compiler can only make some broad assumptions about the CPU's
memory/cache system, and none about the size of the working set.

If the working set with -O2 spills out of the cache but doesn't with
-Os then you get a performance improvement from -Os, for the next CPU
with bigger caches it can swing back.

> [Also, are there that man AMD64 machines with limited memory? Or IA64?]

Swap is now mostly irrelevant for performance discussions, if you hit
swap you won't have performance anyway. :-)


Thiemo



Reply to: