optimization (was: lunuxcaffe; logo contest - mystery font)

Francois Ouellette fouellet-cpI+UMyWUv9BDgjK7y7TUQ at public.gmane.org
Wed Nov 10 19:48:43 UTC 2004


>From what I know of the M$, Borland and gcc C/C++ compilers and the
resulting generated code very little gain is achieved just by turning a
switch at compile time. Look at the x86 machine code that gets created and
you will see what I am talking about. I did lots of programming for the M$
Flight Simulator on slow machines (i.e. 200MhZ) where effective code is
paramount and I have never found an optimization switch that would make a
difference! On Intel or AMD.

It all depends on how good the low-level x86 code is. And this means, in
case of C, how the compiler can turn some of the C source into x86
instructions that will make the best use of the processor's features. For
example, if you read the tech docs available from Intel and AMD, it is
always about how the x86 code is written in the first place that will make
the program run faster by using the processor's features (such as MMX,
3DNow!, SSE and other extensions).

The basic thing is, x86 code should run on any x86-compatible chip. If the
instructions are put in a way that an enhanced feature of a given
processor can be used, the processor may make use of it. Extensions to the
x86 instruction set such as 3DNow! on AMD have to be specifically
programmed (or generated by the high-level compiler) to be effective. Code
written specifically for 3DNow! will obviously not work well on Intel.

Other optimizations deal mostly with addressing and branch-prediction
which depend entirely on how good the source code is in the first place.
One of the AMD tech docs says specifically:
"The micro-architecture of AMD processors most closely resembles the P6,
Pentium II and Pentium III micro-architectures, and in most cases
selecting P6/PII/PIII-specific optimization result in the highest
performance for AMD processors (for example -G6 for Microsoft Visual
C/C++)."

My advice, write good source code, and do not rely on the compilers
features to improve anything!

 François Ouellette
<fouellet-cpI+UMyWUv9BDgjK7y7TUQ at public.gmane.org>

> Original message:
>-----------------
> Are their real world lists of compiler / CPU / applications
> combinations with the largest gains ?



--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list