Multiple choice

Which of the following optimisations avoids a test at every iteration?

  1. Loop ramming

  2. Loop unrolling

  3. Both (1) and (2)

  4. Either (1) or (2)

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Loop unrolling replicates the loop body multiple times within a single iteration, thereby reducing the number of loop control instructions executed. By processing multiple elements per iteration, the branch prediction overhead and loop condition testing are minimized, significantly improving performance for computationally intensive loops.