c - 为什么大步幅的空间局部性很差?

标签 c computer-science

我读了《计算机系统:程序员的视角》。
第 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/

相关文章:

c - 没有正确数字的递归数字总和

computer-science - 堆栈在微处理器中的作用是什么?

time-complexity - 解决 : T(n) = T(n/2) + n/2 + 1

regex - 无确定化的 NFA 最小化

java - 资格是什么意思?

c - 除了在头文件中声明的那些之外,程序是否需要来自 .so 共享库的其他符号?

c - 为什么这样会产生无限循环(C,While Loop)

c - 函数未提供有效输出(Visual Studio 2010 上的 C)

c - 如何在 C 中将文件流转换为字符串?

算法分析-渐近分析