What is a “cache-friendly” code?

前端 未结 9 2200
误落风尘
误落风尘 2020-11-22 02:16

What is the difference between \"cache unfriendly code\" and the \"cache friendly\" code?

How can I make sure I write cache-efficie

9条回答
  •  孤城傲影
    2020-11-22 02:39

    Be aware that caches do not just cache continuous memory. They have multiple lines (at least 4) so discontinous and overlapping memory can often be stored just as efficiently.

    What is missing from all the above examples is measured benchmarks. There are many myths about performance. Unless you measure it you do not know. Do not complicate your code unless you have a measured improvement.

提交回复
热议问题