skip to content
Alvin Lucillo

Prefetcher and arrays

/ 1 min read

💻 Tech

One of the ways to be mechanically sympathetic with the machine is by using contiguous memory, such as arrays and slices. This approach is efficient because of the way memory is accessed by the processor. The less time it takes for the data to get into the processor, the lower the internal latencies. Lower internal latencies allow the application to perform its tasks faster. Data from main memory travels through caches before it gets to the processor. Frequently accessed data is stored in the cache lines of caches, and the prefetcher knows which data is most frequently accessed. One way to help the prefetcher is to arrange data in contiguous order. This is why array and slice data structures are efficient and mechanically sympathetic.