c++ - Linked-lists versus array in performance when dealing with sequentially accessed objects? -
i designing game in maximum of approximately 10,000 objects used per level. each frame of objects accessed in sequential order @ least once, twice or more. right using arrays curious if linked-lists better suited handle such task.
i've never used linked-lists seems applicable time use them, , since project i'm working on learning-one as else, try new approach handling objects in game. linked lists seem way save space , speed game up, due inexperience curious if there noticeable performance lost switching linked-lists. (normally motto try , see, in case requires fair amount of work go implementing linked lists on arrays, , i've spent lot of time on designing how levels , objects work already, i'm bit sick of @ moment.)
unless very frequently inserting , removing elements in middle of sequence, array outperform linked list (though, there a handful of scenarios in linked lists useful).
with linked list, lose benefits of prefetching @ cpu level, since each node has fetched individually.
of course, since c++, can test performance difference swapping out usage of std::vector
std::list
, right? :-)
Comments
Post a Comment