In his magnificent edition, Ulrich Drapper passes a test, which I cannot completely deceive.
He talks about hiding places and biases. First, he shows a test in which he accesses an array of elements of 16 bytes each (one pointer and one 64-bit integer, each element has a pointer to its next, but which is not entirely appropriate here, really), and for each element it increases its value by one.
Then it proceeds to show another test, in which it accesses the same array, but this time it stores in each element the sum of its value with the value of the next element.
Then, the data for these two tests is compared, and it shows that with a working set smaller than the total size of L2D $ (but larger than the total size of L1D $), the second test works better than the first, and its motivation is that reading from the next element acts as a “forced prefetch”, which improves performance.
Now, what I don’t understand, how can this be read as a prefetch, when we do not just pre-read this line, but actually read it and immediately use this data? Shouldn't it look like this when a new element accesses the first test? In fact, in my opinion, I see the second example, very similar to the first, with the only difference that we save in the previous element, and not in the very last one (and we sum the two instead of increasing).
To get a more accurate reference to the actual text, the test in question is discussed on page 22, the third right paragraph, and its relative graph is Figure 3.13 on the next page.
, , . "Inc", "Addnext0". , "Follow" , .
