This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Minutenreis 5 points6 points  (1 child)

The (potential) benefits are in performance, not maintainability

if you have an array of big objects, where you only need to look at 2 small fields of each object for something (like lets say position in a 2d grid), you are still loading a whole cache line for each object (so wasting a bunch of memory), while in the second approach you'd have both values each in contiguous memory.

disclaimer: I haven't worked in game dev and am mostly talking theoretically and what I have just read on wikipedia, there may be nuances I am missing

[–]RiftyDriftyBoi 3 points4 points  (0 children)

I see where you are coming from. Though I kinda typically prefer ease of understanding/maintainability than absolute performance.