Design code to fit in CPU Cache?

前端 未结 7 1957
谎友^
谎友^ 2021-01-31 11:24

When writing simulations my buddy says he likes to try to write the program small enough to fit into cache. Does this have any real meaning? I understand that cache is faster

7条回答
  •  别跟我提以往
    2021-01-31 11:58

    A useful paper that will tell you more than you ever wanted to know about caches is What Every Programmer Should Know About Memory by Ulrich Drepper. Hennessey covers it very thoroughly. Christer and Mike Acton have written a bunch of good stuff about this too.

    I think you should worry more about data cache than instruction cache — in my experience, dcache misses are more frequent, more painful, and more usefully fixed.

提交回复
热议问题