Write short notes on Loop optimization

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:

  1. 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.
  2. Elimination of induction variables.
  3. Reduction in strength.
  4. Loop unrolling.
  5. Looop jamming.

Leave a Reply