linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Compiling 2.2.19 with -O3 flag
@ 2002-05-24  6:51 samson swanson
  2002-05-24 14:42 ` Alan Cox
  0 siblings, 1 reply; 9+ messages in thread
From: samson swanson @ 2002-05-24  6:51 UTC (permalink / raw)
  To: linux-kernel

hi everyone. [all done for fun]

I compiled 2.2.19 with the -O3 flag. then benched with
crafty (chess engine) and it peformed faster in that
respect.

I would like to ask when compiling with -O3 flag on a
kernel such as 2.2.19, what harm / side effect will I
feel later on if any? will i loose speed in other area's?

__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Compiling 2.2.19 with -O3 flag
  2002-05-24  6:51 Compiling 2.2.19 with -O3 flag samson swanson
@ 2002-05-24 14:42 ` Alan Cox
  2002-05-24 15:19   ` Robert Love
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Cox @ 2002-05-24 14:42 UTC (permalink / raw)
  To: samson swanson; +Cc: linux-kernel

> I would like to ask when compiling with -O3 flag on a
> kernel such as 2.2.19, what harm / side effect will I
> feel later on if any? will i loose speed in other area's?

Bench it and see. From my own experience -O3 made the kernel a lot larger
and reduced overall performance - in part because the kernel already 
explicitly figures out what it wants inlined.

Interestingly enough -Os outperformed -O2

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Compiling 2.2.19 with -O3 flag
  2002-05-24 14:42 ` Alan Cox
@ 2002-05-24 15:19   ` Robert Love
  2002-05-24 15:44     ` Alan Cox
  2002-05-24 16:45     ` Marcus Meissner
  0 siblings, 2 replies; 9+ messages in thread
From: Robert Love @ 2002-05-24 15:19 UTC (permalink / raw)
  To: Alan Cox; +Cc: samson swanson, linux-kernel

On Fri, 2002-05-24 at 07:42, Alan Cox wrote:

> Bench it and see. From my own experience -O3 made the kernel a lot larger
> and reduced overall performance - in part because the kernel already 
> explicitly figures out what it wants inlined.
> 
> Interestingly enough -Os outperformed -O2

Heh, now that is interesting.

Or maybe not - not too long ago I did some tests of the various
optimization options in gcc 2.96 or so and found that -O2 generates
smaller code in most cases than -Os.  -Os also did not perform as good,
but I was just testing a few bits of code - nothing as versatile as the
kernel.

The end result was I recommend -O2 for both performance and size.  Maybe
I should retest against the kernel...

	Robert Love


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Compiling 2.2.19 with -O3 flag
  2002-05-24 15:19   ` Robert Love
@ 2002-05-24 15:44     ` Alan Cox
  2002-05-24 16:45     ` Marcus Meissner
  1 sibling, 0 replies; 9+ messages in thread
From: Alan Cox @ 2002-05-24 15:44 UTC (permalink / raw)
  To: Robert Love; +Cc: Alan Cox, samson swanson, linux-kernel

> Or maybe not - not too long ago I did some tests of the various
> optimization options in gcc 2.96 or so and found that -O2 generates
> smaller code in most cases than -Os.  -Os also did not perform as good,
> but I was just testing a few bits of code - nothing as versatile as the
> kernel.

I've done that test with 2.95 and egcs-1.1.2 (its a while back). I've not
check with 2.96, 3.0.4 or 3.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Compiling 2.2.19 with -O3 flag
  2002-05-24 15:19   ` Robert Love
  2002-05-24 15:44     ` Alan Cox
@ 2002-05-24 16:45     ` Marcus Meissner
  2002-05-24 16:54       ` Robert Love
  1 sibling, 1 reply; 9+ messages in thread
From: Marcus Meissner @ 2002-05-24 16:45 UTC (permalink / raw)
  To: linux-kernel

In article <1022253543.962.236.camel@sinai> you wrote:
> On Fri, 2002-05-24 at 07:42, Alan Cox wrote:

>> Bench it and see. From my own experience -O3 made the kernel a lot larger
>> and reduced overall performance - in part because the kernel already 
>> explicitly figures out what it wants inlined.
>> 
>> Interestingly enough -Os outperformed -O2

> Heh, now that is interesting.

Not really, -Os implies -O2, cf gcc/toplev.c:

          if ((p[0] == 's') && (p[1] == 0))
            { 
              optimize_size = 1;

              /* Optimizing for size forces optimize to be 2.  */
              optimize = 2;
            }

CIao, Marcus

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Compiling 2.2.19 with -O3 flag
  2002-05-24 16:45     ` Marcus Meissner
@ 2002-05-24 16:54       ` Robert Love
  2002-05-24 17:44         ` Christoph Hellwig
  0 siblings, 1 reply; 9+ messages in thread
From: Robert Love @ 2002-05-24 16:54 UTC (permalink / raw)
  To: Marcus Meissner; +Cc: linux-kernel

On Fri, 2002-05-24 at 09:45, Marcus Meissner wrote:

> > Heh, now that is interesting.
> 
> Not really, -Os implies -O2, cf gcc/toplev.c:

Well, according to Alan -Os outperforms -O2.  So either the code is
smaller _and_ faster - and that is surely interesting - or the code is
_not_ smaller and -Os is a misnomer.  Seems interesting to me.

	Robert Love


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Compiling 2.2.19 with -O3 flag
  2002-05-24 16:54       ` Robert Love
@ 2002-05-24 17:44         ` Christoph Hellwig
  2002-05-24 17:55           ` Robert Love
  0 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2002-05-24 17:44 UTC (permalink / raw)
  To: Robert Love; +Cc: Marcus Meissner, linux-kernel

On Fri, May 24, 2002 at 09:54:04AM -0700, Robert Love wrote:
> On Fri, 2002-05-24 at 09:45, Marcus Meissner wrote:
> 
> > > Heh, now that is interesting.
> > 
> > Not really, -Os implies -O2, cf gcc/toplev.c:
> 
> Well, according to Alan -Os outperforms -O2.  So either the code is
> smaller _and_ faster - and that is surely interesting - or the code is
> _not_ smaller and -Os is a misnomer.  Seems interesting to me.

-Os implies -O2 + additional size-reducing features:

[hch@sb hch]$ grep -r optimize_size /work/people/hch/gcc/gcc | wc -l
    250
[hch@sb hch]$

A bunch of matches are in ChangeLog and most are target-specific,
but I guess you got the point..


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Compiling 2.2.19 with -O3 flag
  2002-05-24 17:44         ` Christoph Hellwig
@ 2002-05-24 17:55           ` Robert Love
  2002-05-24 18:00             ` Christoph Hellwig
  0 siblings, 1 reply; 9+ messages in thread
From: Robert Love @ 2002-05-24 17:55 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Marcus Meissner, linux-kernel

On Fri, 2002-05-24 at 10:44, Christoph Hellwig wrote:

> -Os implies -O2 + additional size-reducing features:
> 
> [hch@sb hch]$ grep -r optimize_size /work/people/hch/gcc/gcc | wc -l
>     250
> [hch@sb hch]$
> 
> A bunch of matches are in ChangeLog and most are target-specific,
> but I guess you got the point..

I know this...maybe I am not being clear.  I realize -Os is a derivate
of -O2, but is it not an interesting note if -Os can be as fast (or
faster) than -O2 and still generate smaller binaries?  That is my point.

If -Os is equivalent in speed to -O2 but also generates smaller objects,
then why have -O2?  If it does not generate smaller objects (which is
what my testing has shown) then it is worthless.  Unless it is faster
than -O2, like Alan said, in which case then the two options need to
rethink themselves ;-)

	Robert Love


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Compiling 2.2.19 with -O3 flag
  2002-05-24 17:55           ` Robert Love
@ 2002-05-24 18:00             ` Christoph Hellwig
  0 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2002-05-24 18:00 UTC (permalink / raw)
  To: Robert Love; +Cc: Marcus Meissner, linux-kernel

On Fri, May 24, 2002 at 10:55:20AM -0700, Robert Love wrote:
> I know this...maybe I am not being clear.  I realize -Os is a derivate
> of -O2, but is it not an interesting note if -Os can be as fast (or
> faster) than -O2 and still generate smaller binaries?  That is my point.

I've seen it beeing faster with gcc 2.95.  Alan's point was (and I think
the explanation is plausible) is that it is faster exactly _because_ it
produces smaller code due to the instruction cache behaviour of many
current CPUs.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2002-05-24 18:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-24  6:51 Compiling 2.2.19 with -O3 flag samson swanson
2002-05-24 14:42 ` Alan Cox
2002-05-24 15:19   ` Robert Love
2002-05-24 15:44     ` Alan Cox
2002-05-24 16:45     ` Marcus Meissner
2002-05-24 16:54       ` Robert Love
2002-05-24 17:44         ` Christoph Hellwig
2002-05-24 17:55           ` Robert Love
2002-05-24 18:00             ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).