Next: Make it Work Before
Up: Efficiency Issues for Ray
Previous: Introduction
Optimization can be a seductive activity leading to endless tweaks and
changes of code. The most important part of optimization is knowing
when not to do it. Two common cases are:
- Code or system is not run frequently.
- Code is a small fraction of overall time.
In other words, code should only be optimized if it will make a
significant effect on the final system and the final system will be
used frequently enough to justify the programmer's time and the chance
of breaking something.
It helps to have a set of
principles to follow in order to guide the process of optimization.
The set I use is:
- Make it work before you make it fast.
- Profile everything you do.
- Complexity is bad.
- Preprocessing is good.
- Compute only what you need.
Comments: Brian Smits
1999-02-19