Re: Optimal programming advice



>Does anyone know of any good general guidelines for making code faster?

1) Profiling and measurement. Theories are nice, data is better.
2) Time/Space trade-offs -- precompute tables and look-up, but don't assume that is faster, measure it.
3) Trading clarity for speed is ALWAYS a mistake, except in throw-away code. (No code is *really* throw-away.)
4) Optimize from high level to lower levels (e.g., don't spend lots of time trying to hand optimize some sub in
assembly until the last (probably never) step). Major code organization issues first! Loop orders on multi-
dimensional arrays &c.
5) Will a 10% speed improvement really mean anything to anyone? Or do you need 10x for it to be worthwhile?
.