Some optimization results

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Thu May 9 11:25:04 AEST 1991


In article <22683 at yunexus.YorkU.CA> oz at yunexus.yorku.ca (Ozan Yigit) writes:
> If by "serious thought about optimization" you mean something like your
> last attempt to optimize and make a mess out of what was already cleanly
> done by Richard O'Keefe, I think you have yet to find out the meaning of
> the word [counterproductive]. ;-)

Yeah, that's exactly the sort of thing I mean, and it turned out to be
extremely productive.

The code after O'Keefe's optimizations would not be automatically
vectorized by the Cray compiler. The code after my optimizations would,
with no special directives or further work on the programmer's part.
In other words, the microoptimizations that you take such pains to
criticize ended up speeding up the code by a factor of fourteen.

That's right, a factor of fourteen.

FOURTEEN TIMES FASTER. When's the last time you saw that kind of speed?

Maybe you should review your definition of ``productive'' before you go
criticizing my programming techniques. I can't afford to ignore speedups
by a factor of fourteen. (Dik and I both thought the discussion was over
back then, so I didn't bother posting these results before.)

Even with vectorization off, my minor changes produced a 15% speedup,
and up to 50% on smaller machines. That's quite a lot if the code in
question is a bottleneck. Maybe my changes did make a ``mess'' out of
those fifteen lines, but I think it was well worth it.

Now that you know what you're talking about, Ozan, what conclusions
would you like to draw from that example?

---Dan



More information about the Comp.lang.c mailing list