Low-Level Optimizations
Low-level optimizations are somewhat dubious, because they depend on understanding
various machine details. Because machines vary, the accuracy of these low-level
assumptions can sometimes be questioned.
Typically, a set of general rules can be determined that are more-or-less consistent
across machines. Here are some examples:
* 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).
None of these rules are etched in stone. Some of these rules are becoming
less and less valid as time passes. We'll address these issues in more detail
later.