Computer Systems A Programmer's Perspective Second Edition

In Section 6.2, we introduced the idea of locality and talked in qualitative terms
about what constitutes good locality. Now that we understand how cache memo-
ries work, we can be more precise. Programs with better locality will tend to have
lower miss rates, and programs with lower miss rates will tend to run faster than
programs with higher miss rates. Thus, good programmers should always try to
 
write code that is
cache friendly
, in the sense that it has good locality. Here is the
basic approach we use to try to ensure that our code is cache friendly.
1.
Make the common case go fast.
Programs often spend most of their time in a
few core functions. These functions often spend most of their time in a few
loops. So focus on the inner loops of the core functions and ignore the rest.
2.
Minimize the number of cache misses in each inner loop.
All other things being
equal, such as the total number of loads and stores, loops with better miss rates
will run faster.
 
 

最新文章

  1. html传值 location.search取
  2. AS快捷键
  3. 给li设置float浮动属性之后,无法撑开外层ul的问题。(原址:http://www.cnblogs.com/cielzhao/p/5781462.html)
  4. SQL注入测试平台 SQLol -6.CHALLENGES挑战
  5. Windows下Cygwin中使用NCView
  6. P1011 传纸条//dp优化改进状态表示
  7. Linux Zynq GPIO中断
  8. [河南省ACM省赛-第三届] 聪明的kk (nyoj 171)
  9. 你跟上技术趋势了么? 来看看这10场2017热门it技术会议!
  10. hihoCoder1310 岛屿 (dfs)
  11. 【Luogu1876】开灯(数论)
  12. antd按需加载,配置babel-plugin-import插件,编译后报错.bezierEasingMixin()解决方案
  13. [原]openstack-kilo--issue(十六) instance can't get ip 虚拟机不能得到ip(1)
  14. PHP之数组函数
  15. React学习笔记一:入门知识概览
  16. code vs 3492 细胞个数
  17. iOS真机调试出现Development cannot be enabled while your device is locked.
  18. Arrays.sort和Collections.sort实现原理解析
  19. intel-FPGA的片内存储器问题
  20. SqlServer中创建Oracle链接服务器

热门文章

  1. [译] 在Web Forms 中使用ASP.NET Routing
  2. IIS-如果外网访问不到 域名
  3. dos基本命令
  4. 【转】cloudera新增用户权限配置
  5. nignx重启启动关闭
  6. Linux磁盘分区与格式化
  7. nginx查看post请求日志
  8. MongoDB安装(一)
  9. 错误3 error C3859: 超过了 PCH 的虚拟内存范围;请使用“-Zm120”
  10. BZOJ2725 : [Violet 6]故乡的梦