Some optimization results

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Tue May 7 10:46:36 AEST 1991


In article <186 at shasta.Stanford.EDU> shap at shasta.Stanford.EDU (shap) writes:
> >(a)	Make arrays static or malloced; don't make them automatic.
> Don't bother. Get a serious compiler.

``> (a) Write fast programs.'' ``Don't bother. Get a Cray.''

Unfortunately, buying a Cray will only help code that is never used on
another machine. Similarly, getting a better compiler will only help
code that is distributed in binary form for that machine, or is not
distributed at all.

I find both pieces of advice remarkably counterproductive, as they take
time away from serious thought about optimization.

> More to the point, use the memcmp() or bcmp() routines.  They are probably
> better suited to the problem because they are hand-tuned to the system
> at hand.

Piercarlo's study some time back proved otherwise.

> In general, the compiler is probably good at unrolling.

Most compilers can't unroll anything.

---Dan



More information about the Comp.lang.c mailing list