Code Optimization
1 Code Optimization
Outline Machine-Independent Optimization Code motion Memory optimization Suggested reading -5.2~56
2 Outline • Machine-Independent Optimization – Code motion – Memory optimization • Suggested reading – 5.2 ~ 5.6
Motivation Constant factors matter too easily see 10: 1 performance range depending on how code is written must optimize at multiple levels algorithm, data representations, procedures, and loops
3 Motivation • Constant factors matter too! – easily see 10:1 performance range depending on how code is written – must optimize at multiple levels • algorithm, data representations, procedures, and loops
Motivation Must understand system to optimize performance how programs are compiled and executed how to measure program performance and identify bottlenecks how to improve performance without destroying code modularity and generality
4 Motivation • Must understand system to optimize performance – how programs are compiled and executed – how to measure program performance and identify bottlenecks – how to improve performance without destroying code modularity and generality
5. 2 Expressing Program Performance
5 5.2 Expressing Program Performance