Optimisation
Optimise only when:
- The program is really slow
- The optimised program will continue to be correct
- The optimised program will continue to be readable
- The optimised program will continue to be reliable (cf buffer checks)
Common techniques:
- Use more efficient data structures and algorithms
- Execution profile; focus on hot spots
- Use a more efficient environment (e.g. move a 4GL into C++)
- Capitalise on the compiler's optimisations
- Optimise code
- Efficient use of hardware resources (parallelism)
- Avoid system calls
- Avoid the use of external data
- Save temporary results
- Pre-calculate results