Next: Tail Recursion
Up: Source Optimization
Previous: Source to Source Transformation
  Contents
  Index
Style Recommendations
style recommendations
Source level optimization makes possible a clearer and more relaxed programming
style:
- Don't use macros purely to avoid function call. If you want an
inline function, write it as a function and declare it inline. It's
clearer, less error-prone, and works just as well.
- Don't write macros that try to ``optimize'' their expansion in
trivial ways such as avoiding binding variables for simple
expressions. The compiler does these optimizations too, and is less
likely to make a mistake.
- Make use of local functions (i.e., labels or flet)
and tail-recursion in places where it is clearer. Local function
call is faster than full call.
- Avoid setting local variables when possible. Binding a new
let variable is at least as efficient as setting an existing
variable, and is easier to understand, both for the compiler and the
programmer.
- Instead of writing similar code over and over again so that it
can be hand customized for each use, define a macro or inline
function, and let the compiler do the work.
Next: Tail Recursion
Up: Source Optimization
Previous: Source to Source Transformation
  Contents
  Index
Peter Van Eynde
2001-03-08