-O3 vs. -O2 (was Re: [ale] sharing an experience....debian....)

Matthew Macumber mmacumbe at pigseye.kennesaw.edu
Wed Feb 11 23:03:34 EST 2004


-O3 will turn on loop unrolling, which can dramatically increase the size of 
the binaries. This can cause some code to not fit in the CPU cache. Depending 
on the architecture, a cache miss can cause execution delay of up to 10 
cycles. So, this can be the cause of the diminished performance.

-Matthew

On February 11, 2004 10:44 pm, Jeff Hubbs wrote:
> There's another reason why I ask.  I frequently install Gentoo on slow
> machines because a) I want to wring every last bit of performance I can
> out of the hardware available and b) I'm not under time pressure to do
> so :)
>
> But, according to this, in doing so and accepting the -O3 optimization
> suggested, I may only be hurting myself, ESPECIALLY if after building
> gcc, glibc, etc. in the bootstrap phase with -O3 and subsequently
> compiling everything else with that gcc, it might be taking m hours
> (days?) longer than necessary.
>
> I'd run tests. but I'd better do it on a CPU from this century or it'll
> take so long I'll forget what I'm testing.
>
> - Jeff
>
> On Wed, 2004-02-11 at 22:37, Jeff Hubbs wrote:
> > Can someone explain to me why the -O3 optimization would make programs
> > run *slower*?  In asking, I'm not trying to cast aspersions or challenge
> > the assertion, I'm really only just trying to ask how this is so.
> >
> > - Jeff
> >
> > On Wed, 2004-02-11 at 19:23, James Sumners wrote:
> > > Stupid exmh didn't send this with the correct From: address earlier
> > > today.
> > >
> > > >From the November 04, 2003 Debian news
> > >
> > > (http://lists.debian.org/debian-news/debian-news-2003/msg00056.html):
> > >
> > >  --- Begin Quote ---
> > >  Debian faster than Gentoo? Matt Garman [2]wondered why his C++
> > >  program ran dramatically slower when compiled on a Gentoo machine than
> > >  when compiled with Debian Sid. He later [3]reported that recompiling
> > >  the Gentoo C++ libraries with less aggressive optimization flags (-O2
> > >  instead of -O3) eliminated the speed difference. Matt also [4]added
> > >  that Debian and other distributions are conservative, but set up by
> > >  very experienced people.
> > >
> > >   2. http://article.gmane.org/gmane.linux.gentoo.user/50924
> > >   3. http://article.gmane.org/gmane.linux.gentoo.user/50973
> > >   4. http://article.gmane.org/gmane.linux.gentoo.user/50953
> > >  --- End Quote ---
> > >
> > >  Basically, Red Hat (Fedora) packages are typically compiled in a
> > > haphazard fashion in relation to the other packages in the
> > > distribution. The packages in Debian go through an arduous testing
> > > process and are built according to rather strict rules.
> > >
> > > James Sumners
> > >
> > > On Wed, 11 Feb 2004 13:12:30 -0500
> > >
> > > Keith Morris - IQ <keith at iqtv.com> wrote:
> > > > Hi all, just wanted to share a quick experience and get your opinions
> > > > if you are willing.
> > > >
> > > > I have been using linux off and on since Redhat 5.1 and exclusively
> > > > for the last 3 years at home.  I have pretty much been a redhat man
> > > > with no complaints.  I use Fedora Core 1 on my 2 main machines at
> > > > home (both 1.6GHz).  Well, recently I got a PIII 866 to play with and
> > > > installed FC1 on it and the speed was really quite sluggish.  Played
> > > > with a few more distros which I wasn't really happy with.  Well, I've
> > > > always been afraid of Debian with it's infamous hell-installer, but
> > > > with it's new Beta installer, I decided to try it.
> > > >
> > > > After a pretty painless net-install, I was totally shocked with the
> > > > speed of Debian.  Easily twice as fast as Fedora on the 866 using the
> > > > *SAME* software (Gnome 2.4, KDE 3.1.5, OpenOffice, Evolution, XFT
> > > > support, antialiasing, etc.) I still have not gotten the sound
> > > > working, but believe that I will be able to (with a few posts to the
> > > > ALE list :)) The only main difference is that I formatted / with
> > > > reiserfs instead of ext3 with FC1.
> > > >
> > > > I was wondering if anyone could guess why debian would be sooooo much
> > > > faster with basically the same "Desktop" type of configuration? Do
> > > > many of you use Debian?
> > > >
> > > > I will probably stick with Debian on this machine to learn about the
> > > > different ins-and-outs.  I absolutely *love* apt-get for debian.  I
> > > > have used it with rpms on redhat, but it seems better with
> > > > debs...dunno...
> > > >
> > > > Anyway, thanks for letting me share.
> > > >
> > > > Keith Morris
> > > > Creative Director
> > > > Design / Effects
> > > > IQ television group
> > > > http://www.iqtv.com
> > > >
> > > >
> > > > _______________________________________________
> > > > Ale mailing list
> > > > Ale at ale.org
> > > > http://www.ale.org/mailman/listinfo/ale



More information about the Ale mailing list