First page Back Continue Last page Overview Graphics
Tuning Comments
First priority with any program is correctness, it does not matter how fast a program is if it wrong
Algorithms:
- Algorithms can make an immense difference, e.g. O(n^2) vs. O(n log n) sorting
- Most local optimizations only provide constant factor improvement
- The fastest code is the code that never executes
Make use of the compiler optimizer:
- -O3 in gcc
- -fprofile-arcs and -fbranch-probabilities to improve code
GCC generates the same code regardless of -g, keep the -g so OProfile can do a better job mapping profiling information back to code
Notes: