Memory model β
Array = value1, value2, value3 ...
Object = Field1, Field2, Field3 ...
If you have an array of objects, then the memory looks like this: Field1, Field2, Field3, Field1, Field2, Field3...
If you have an object with arrays, then the memory looks like Field1, Field1, Field1.... Field2, Field2, Field2...
Continuous memory access is faster than non-contiguous memory access.
source share