Design code to fit in CPU Cache?

前端 未结 7 1840
谎友^
谎友^ 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:46

    Most C/C++ compilers prefer to optimize for size rather than for "speed". That is, smaller code generally executes faster than unrolled code because of cache effects.

提交回复
热议问题