decreasing cache misses through good design

后端 未结 6 1759
广开言路
广开言路 2020-12-23 10:34

How to decrease the number of possible cache misses when designing a C++ program?

Does inlining functions help every time? or is it good only when the program is CPU

6条回答
  •  独厮守ぢ
    2020-12-23 11:04

    Inlining functions runs can risk harming the instruction cache. And if memory is not fetch bound, then it is unlikely to make much ( if any ) difference.

    As always, any optimization should be informed by profiling rather than hunches. Not to mention that you will need to understand what the profiler is telling you which implies familiarity with assembly language and the particular characteristics of the plaftorm you are optimising for.

    A bit old now, but Mike Abrash's "Graphic's Programming Black Book" still has lots of good general advice.

提交回复
热议问题