Loop optimization : most of the execution time of a scientific program spent on loops. The running lime of program may he improved we o o of the followin
1 Decrease the number of Malmo-Ms in the inner loops.
2. Increase the number of statements In the outer loops. The loop optimization aims to mitihnize the time spent in the loop, often by reducing the number of operations In the loop.
The different loop optimizations that can be applied to a loop are:
- Move loop.invariants. A loop-invariant is a computation that yields the same result independent of the toucher of times through the loop. Such computation should be moved out of the loop so that the resulting code is optimized.
- Elimination of induction variables.
- Reduction in strength.
- Loop unrolling.
- Looop jamming.