Processors have caches.
Compared to processor speed, access to system memory is slow. That's why processors have caches (made from ultrafast memory).
Each processor cache level has different sizes and speeds.
Therefore, to achieve the highest possible speed, it is extremely important to avoid updating the cache at the lowest levels (unfortunately, these are also the smallest caches).
Both code and data will force the cache to be updated. Therefore, in both cases, size matters.
For example: code can generate cache misses on jump or call . data can generate cache misses when loading variable into remote address .
There are other problems, such as alignment , which can greatly affect speed, but cost nothing more than a processor miss (reloading the processor cache is related to synchronizing the processor core and this is not an easy task: it can take something like 250 CPU cycles! )
Without going into platform-specific details, this is what can be said.
Conclusion: keep it simple. And a little beautiful.
source share