compiler optimizations [was: i686 repository]
florin at andrei.myip.org
Tue Mar 9 18:24:32 UTC 2004
On Tue, 2004-03-09 at 05:25, Phil Hannent wrote:
> Does anyone know of a repository that has i686 binaries compiled for fedora?
> While the argument is that there isn't much benefit from having
> optimised binaries, the fact that Gentoo linux exists shows there is a
For normal packages you shouldn't need a thorough optimization, because
the gains are so small it's difficult to even measure them.
And by the way, optimizing for i686 is a "suboptimal optimization" :-)
I just use the default packages most of the time. There are cases when
an aggressive optimization is desireable and yields measurable results
(multimedia apps such as transcoders, music apps, etc.), but then you
have to perform a full optimization on them.
As a rule, if an application does not fall under at least one of these
categories, it's not worth pursuing aggressive optimizations:
- it runs at 100% CPU usage for a long time (e.g. when transcoding from
DVD to DivX)
- it has to deliver very low latency (e.g. when recording audio with the
If at least one criterion is satisfied, you may try to optimize (but
don't expect miracles every single time).
Myself, i compile (rebuild RPMs) those apps with "-march=athlon-xp
-mcpu=athlon-xp" (because my system is an AthlonXP/1800) and some other
minor tweaks. I keep that in my ~/.rpmrc file (sorry if my mailer splits
optflags: athlon -O3 -march=athlon-xp -mcpu=athlon-xp -mfpmath=sse -pipe
But remember, i'm for the most part focused on multimedia type of
Often, the difference between -O2 and -O3 is bigger than what
-march=athlon-xp provides (and no, -O3 is not always faster). Also, all
those -fomit-frame-pointer type of arcane options can deliver unexpected
There is no such thing as "this is The Magic Gcc Option that will make
all your apps run 10x faster". Optimizing apps is DIFFICULT. What are
you optimizing for? Speed? Latency? Memory usage? Are you running other
apps at the same time? How big is your CPU's cache? Are you sure the
app's code can take advantage of all those gcc bells and whistles? And
last but not least, do you know how to properly benchmark different
Believe me, optimizing an app is like cracking open a clockwork puppet:
all of a sudden all kinds of tiny little springs and gear pop out of
nowhere, leaving you scratching your head and asking yourself how the
hell are you going to put all that back inside.
If you really want to squeeze all speed out of an app, you'll spend an
incredible amount of time tweaking gcc options and doing benchmarks for
days and weeks. And then a minor detail changes with the conditions
(like, you start using another app at the same time) and that changes
It sucks. Just use some generic optimizations, you'll do yourself a
service. Unless your needs are very special, such as if you build some
kind of appliance or something (but then you probably wouldn't use a
generic distribution such as Fedora).
More information about the users