[wplug] Compiler questions

Dave Neuer mr_fred_smoothie at yahoo.com
Wed Feb 2 16:08:55 EST 2005


--- "Embery, Nathan" <Nathan.Embery at crowncastle.com>
wrote:

> :) Let me rephrase...

OK. I will rephrase, as well (just please, don't jump
off a bridge, because my Mom will go into an infinite
loop).

"GCC can only optimize to what you tell it."

True to a point.

"So, if someone else has already compiled a piece of
software, even optimizing it for i686 (which is what I
happen to need), what exactly is the point is doing it
myself?"

None, if "which is what I happen to need" is true.
E.g., do you have an Athlon? If so, there are
optimizations that can be performed by the compiler
over and above that which are provided by "i686",
3DNow being a fine example. 3DNow is a non-intel SIMD
instruction set: it speeds up certain operations (like
many common graphics operations), and you won't get
that benefit with just "i686." Do you have a P3 or P4?
Again, further optimizations beyond those for "i686"
are possible.

In other words, "i686" is a very generic description
of a processor _family_, which doesn't take into
account a wide variety of processor and instruction
set differences among that family of processors. For a
little more detailed explanation, see esp. the first
couple of paragraphs of
http://gcc.gnu.org/onlinedocs/gcc-3.3/gcc/i386-and-x86-64-Options.html#i386%20and%20x86-64%20Options

Note especially how -mcpu does _not_ change the
available instructions, only the way the basic
universally availabe i386 instructions are scheduled,
while -march optimizes the scheduling _and_
instruction set.

And, as another poster pointed out, it's also possible
to set system-wide (or package-specific) optimizations
like "don't link against library 'blah', which I will
never use, resulting in a smaller binary which makes
better use of my processor's cache" -- again, boosting
performance _and_, in the case of static linking (yes,
Virginia, there is still static linking out there; see
Ardour) freeing up hard drive space.

Again, none of this is meant as an imperative. I'm not
arguing that you _should_ use a source-based distro,
or compile apps yourself. I certainly don't agree w/
your rhetorical example 'I compiled it myself,
therefore it's better.'" That would be meaningless if
in fact you compiled it yourself in the exact same
manner your distributor would have compiled it. I'd go
so far as to assert that "it's better," by itself, is
a meaningless English phrase in almost any context.

Simply trying to answer what I _think_ your original
question was, which is "why might I want to..."

Dave


More information about the wplug mailing list