In the linked list example used in the article, the author seems to be implying that modern processors "already prefetch everything they can get their hands on", and that the prefetch annotation isn't necessary.
Is there an underlying assumption for the linked list case that the items in the list are near each other in memory, or is there additional help from the compiler that marks memory for the next node? I'm not coming up with a mechanism which would allow the processor to understand the structure of the list.
Posted Sep 10, 2010 16:20 UTC (Fri) by jzbiciak (✭ supporter ✭, #5246)
[Link]
It's more likely that a modern CPU will speculate ahead to the next iteration of the loop, which will start to bring in the next structure in the list.
Prefetching considered harmful
Posted Sep 10, 2010 22:51 UTC (Fri) by daglwn (subscriber, #65432)
[Link]
Soon the data items will not even need to be that close to each other. Google "region prefetching" for some articles.
We have to use those billions of transistors for something