[wplug] Compiler questions

Tim Lesher tim at lesher.ws
Thu Feb 3 12:02:13 EST 2005


On Thu, Feb 03, 2005 at 11:05:52AM -0500, Zachary Uram wrote:
> but isn't gcc written in assembler and it can make assembler calls
> i would love to see performance comparisons

What language gcc is written in doesn't have any direct bearing on the
performance of executable code it generates (it happens to be C,
though).

To your original point, it's not possible to make a blanket statement
that hand-crafted assembly language is always faster or slower than
machine-generated assembly language.  However, for most cases, given
the same level of sophistication on the part of the programmer and the
compiler, assembly code can still win.  The problem is that the level
of sophistication required continues to rise, and it's getting close
to infeasible on the human side (our brains don't enjoy the
exponential increase in processing capacity that our machines do).

One example off the top of my head: AMD's own high-performance
implementation of the LAPACK linear algebra routines are done
partially in hand-crafted assembly.  This isn't because "assembly is
faster", but because a combination of intimate knowledge of the
algorithm you're implementing, intimate knowledge of advanced
instruction set features, and intimate knowledge of CPU instruction
ordering doesn't yet exist in a compiler.

-- 
Tim Lesher <tim at lesher.ws>
http://www.lesher.ws



More information about the wplug mailing list