Prefetching Syntax

Don Clugston dac at nospam.com.au
Wed Dec 26 07:45:42 PST 2007


janderson wrote:
> Here's a suggestion for D 3.0 which looks to me the time at which Walter 
> plans to hit modern processor design hard.  I could be part of the 
> language or perhaps in a less elegant way in the standard lib.
> 
> Due to CPU speeds becoming ever more dependent on good cache 
> optimizations I think something to make prefetching intuitive would be 
> nice.

It's difficult to get much benefit from pre-fetching without significant 
experimentation. The normal fetching prediction mechanism for Pentium and AMD 
processors is very good, and most of the time, it's hard to beat. Examples where 
it's beneficial are very hard to come by (at least, I've not seen any); 
normally, you're better off arranging your data so that the built-in prefetching 
works correctly (this means things like, access data from low memory address to 
high memory, not in the reverse order).
There's much more to be gained by re-arranging data structures, rather than 
explicitly prefetching, I think.

Good sort of stuff to think about, though.



More information about the Digitalmars-d mailing list