Machine-translated by Google. Questions are authored in English.
Top

Discussion

Loop unrolling improves performance chiefly by

  • A.decreasing the amount of code the compiler produces
  • B.removing the need for any registers in the loop body
  • C.guaranteeing that the loop executes only once
  • D.reducing the number of tests and jumps executed

Answer: D

Several iterations in one pass amortise the loop overhead and expose more instructions for scheduling. The cost is a larger body, which may hurt instruction cache behaviour. Compilers therefore choose the unroll factor by heuristic rather than blindly.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.