C/C++ performance of static arrays vs dynamic arrays

前端 未结 5 1353
难免孤独
难免孤独 2021-01-30 14:33

When performance is essential to an application, should consideration be given whether to declare an array on the stack vs the heap? Allow me to outline why this question has co

5条回答
  •  無奈伤痛
    2021-01-30 15:11

    Stalk memory allocation offers quicker access of data than the Heap. The CPU would look for the address in the cache if it does not have it, if it does not find the address in the cache then it would look up in the main memory. Stalk is a preferred location after cache.

提交回复
热议问题