Low-Level Optimizations
Low-level optimizations are dubious, because
they often depend on specific machine details.
However, a set of general rules that are more-or-less consistent across machines include:
- Addition and Subtraction are generally faster than Multiplication.
- Multiplication is generally faster than Division.
- Using tables to evaluate discrete functions is faster than computing them
- Integer caluculations are faster than floating-point calculations.
- Avoid unnecessary computation by testing for various special cases.
- The intrinsic tests available to most machines are greater than,
less than, greater than or equal, and less than or equal to zero (not an arbitrary value).
|