3 ms·
>but pointers inside struct is more 'flexible', for example you can put a 'void *' and cast it to various data types. But then the array and other members won'
by atahanacar 3y ago
>but pointers inside struct is more 'flexible', for example you can put a 'void *' and cast it to various data types.
But then the array and other members won't be next to each other in memory.
- synergy20 3y agothe cache subsystem might be smart enough to cache the first line, e.g. the size of the array etc, then pull the rest of array content from heap and cache the array as needed, should be fine to me, yes two cache misses instead of one at the beginning.
- stefncb 3y agoThe CPU cache simply pulls the memory next to what you loaded. It doesn't interpret what it sees.