I have read a number of documents on the usage of the processor cache. However, I have a lingering question which has not yet been answered. How does the cache perform with a collection of pointers?
I assume that the collection of pointers will be loaded into the cache, and each time I have a pointer access that the cache will be flushed, and the destination of the pointer will be loaded into the cache. Is this correct?
So I have a collection of pointers, which are pointing to objects elsewhere in memory. If I have a concurrent_vector of pointers, I assume that the pointers will be loaded on their own cache line. However the objects which they point to have been allocated with the scalable_allocator. I assume that these objects are located elsewhere in memory, and perhaps not on the same cache line as each other. It seems to me that the first potential performance improvement would be to place the allocated objects themselves into a concurrent_vector so that they are contiguous in memory if I use many of them together. It also seems that I can conserve cache space by using an int to refer to the position of these objects in the concurrent_vector (in the case of 64-bit pointers, this would free up some cache space).
It seems to me that the best performance would occur if the object holding concurrent_vector and the pointer concurrent_vector where far enough away in memory that they were loaded onto their own cache line... that way each could be in the cache at the same time.
Any suggestions or general comments on how the processor cache handles pointers? I assume they are treated as any other data type.