10.6 Optimization Statistics
This chapter has discussed a large number of optimizations, most of which are found
on the control flow graph. The reader may be wondering what the improvements
really are. Is it worth the time and effort at compile time -- not to mention at compiler
creation time -- to perform such aggressive optimizations?
The answer is -- it depends. Statistics have shown that there is a 5-25% improvement
in running time for the loop optimizations:
-
Code motion of loop invariabnt statements
-
Induction variable elimination
There is a 1-5% improvement for:
-
Global common subexpression elimination
-
Dead varible detection
-
Use of algebraic laws
-
Constant propagation
Interestingly, the topic of the next chapter, register allocation, has been shown to
improve code more than the optimizations above. Because good register alloction
does improve code, it is often discussed in chapters on optimization.
The optimizations performed after code generation, peephole optimization, also
have a high payoff. We discuss these in Chapter 11.
|