Performance of an array of pointers

Hello, I'm currently trying, as an experiment, to create my own game engine, but I'm stuck at the entity management system.

I'm slowly becoming more or less obsessed with this whole "cache utilization" thing, and how I might best apply this knowledge to my engine.

I understand that grouping same-type components that will be iterated over very often together in memory is good for performance because you can cut out the code that asks every entity about a specific component, but as I was looking how the C++ port of Artemis ( did it, I noticed they were working with arrays of pointers.

How good is the performance of an array of pointers, as the objects that are pointed to are possibly still spread over the memory?
Regardless of how spread the objects of an array of pointers are, pointer dereferencing is an O(1) operation.
Ok, but I was specifically referring to the cpu cache.

Is the object that's being pointed to automatically loaded into the cache or does the cpu have to fetch it from the ram?
Accessing the pointers is efficient, because they're in linear/consecutive memory. Dereferencing the pointers is unknown because who knows where they're pointing.
Topic archived. No new replies allowed.