decreasing cache misses through good design

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

    Avoid using dynamic memory when it's not necessary. Using new, delete, smart pointers, and so on, tends to spread your program data across the memory. That's not good. If you can keep most of your data together (by declaring objects on the stack, for example), your cache will surely work much better.

提交回复
热议问题