decreasing cache misses through good design

后端 未结 6 1774
广开言路
广开言路 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:06

    Allow CPU to prefetch data efficiently. For example you can decrease number cache misses processing multi-dimensional arrays by rows rather than by columns, unroll loops etc.

    This kind of optimization depends on hardware architecture, so you better use some kind of platform-specific profiler like Intel VTune to detect possible problems with cache.

提交回复
热议问题