《CSAPP》存储器层次结构:在程序中利用局部性

5 篇文章 0 订阅

在学习csapp, 看完了第六章。标记一下, 所以直接引用csapp书中内容了:

 

Putting It Together: Exploiting Locality in Your Programs (The Impact of Caches on Program Performance)

Programmers who understand the nature of the memory hierarchy can exploit this understanding to write
more efficient programs, regardless of the specific memory system organization. In particular, we recommend
the following techniques:
Focus your attention on the inner loops where the bulk of the computations and memory accesses
occur.
Try to maximize the spatial locality in your programs by reading data objects sequentially, in the order
they are stored in memory.
Try to maximize the temporal locality in your programs by using a data object as often as possible
once it has been read from memory.
Remember that miss rates are only one (albeit important) factor that determines the performance
of your code. The number of memory accesses also plays an important role, and sometimes it is
necessary to trade off between the two.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值