As another example of code with potential load-store interactions, consider the following function to copy the contents
Question:
As another example of code with potential load-store interactions, consider the following function to copy the contents of one array to another:
Suppose a is an array of length 1,000 initialized so that each element a[i] equals i.
A. What would be the effect of the call copy_array(a+1,a,999)?
B. What would be the effect of the call copy_array(a,a+1,999)?
C. Our performance measurements indicate that the call of part A has a CPE of 1.2 (which drops to 1.0 when the loop is unrolled by a factor of 4), while the call of part B has a CPE of 5.0. To what factor do you attribute this performance difference?
D. What performance would you expect for the call copy_array(a,a,999)?
Step by Step Answer:
Computer Systems A Programmers Perspective
ISBN: 9781292101767
3rd Global Edition
Authors: Randal E. Bryant, David R. O'Hallaron