Newsgroups: | comp.compilers |
From: | "Julian V. Noble" <jvn@fermi.clas.virginia.edu> |
Keywords: | assembler, performance |
Organization: | University of Virginia |
References: | 93-10-134 |
Date: | Fri, 29 Oct 1993 15:43:36 GMT |
Everyone agrees one should profile one's code, if speed is important. In
many cases one does not even need a profiler because the bottlenecks in
the algorithm are obvious. For example, in a FFT, don't bother using ass'y
to code the table f(k) = exp[2 i pi k / N ] because it is an O(N) process.
Just optimize the inner loop. Similarly, in Gaussian elimination (or in
the LR decomposition) for linear equations, the inner loop code is
executed N^3 times, everything else N^2 or less, so optimize that loop
(it's a short one, too).
The chief bottleneck in hand-optimizing code is the assemble-link-test
cycle. One reason I prefer FORTH to other languages is the built-in
assembler eliminates this step: words defined in assembler execute like
any others, hence can be tested immediately, etc. etc.
I have not yet had the opportunity to try this for a RISC chip, but for
the 80x86 and MC680x0 -based machines this peephole hand optimization
beats anything compilers produce. --jvn
--
Julian V. Noble
jvn@virginia.edu
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.