Tools for Tuning 1
Instrument and simulate on PC (gprof, Quantify, hand-crafted)
Read your compiler manual: understand the switches available to you and what is reliable
Analyse assembly output: learn to love your compiler
Consider assembly code for critical components
Understand your hardware, eg ROM/RAM speeds
Examine locking granularity, thread priorities, data layout, interrupt load, major algorithms, inner loops
Notes:
EXAMPLE: Tweaking C to optimise assembler output for Mandelbrot curve program on Sun 3/60 beat the published top speed of the FPU and the code remained portable!
- Do you know what you are tuning for?
- If more than one, rank, weight and measure.
- Do you have the right tool or tools?
- Have you looked at your compiler output, bus activity, etc?
- Do you know what your tools cannot see? (Eg many tools can’t see cache misses and pipeline empties.)
- Do you understand the relative speeds (etc) of RAM vs ROM storage of code and data?
- Do you know how to tune instructions for different processor versions (eg blends on VC and SPARCompiler) or different cache styles (SPARCompiler)?