Re: compiler optimizations [was: i686 repository]

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

 



Hi Florin,

I tried to recompile quanta 3.2 (very slow app)
and It seems to be about 10% faster with cflags set for athlon-xp.
Now I'm trying to rebuild kde32 and going to rebuild X.
What are chances in optimizing multimedia application
for runtime speed and stability?

michal


Florin Andrei wrote:
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
demand.
    

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" :-)
nowadays.

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
computer)
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
the line):

optflags: athlon -O3 -march=athlon-xp -mcpu=athlon-xp -mfpmath=sse -pipe
-fomit-frame-pointer

But remember, i'm for the most part focused on multimedia type of
things.

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
results.

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
application versions?

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
everything. :-(
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).

  


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux