我读了《计算机系统:程序员的视角》。
第 6 章中的局部性部分。书中认为以大步幅在内存中跳跃的程序具有较差的空间局部性。
那么,如何得出这个结论?
谢谢。
最佳答案
想想空间局部性的定义:
Spatial locality If a particular memory location is referenced at a particular time, then it is likely that nearby memory locations will be referenced in the near future. In this case it is common to attempt to guess the size and shape of the area around the current reference for which it is worthwhile to prepare faster access.
因此,如果您访问的位置不在附近,考虑到您希望“大步”围绕内存,那么您的程序的空间局部性很差。
关于c - 为什么大步幅的空间局部性很差?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24666397/