Better data structure for objects(wall,characters,etc...)

The title might be slightly misleading then? :tipping_hand_man:

Here’s a CppCon talk worth watching. It focuses a lot on optimization for locality/caching, and at about 13 minutes in it gives us a little reality check before diving back into the topic. It goes over a lot of pitfalls of caching and the hardware.

It depends (like if the compiler can inline the function or not), otherwise I think function calls are more likely to cause cache swaps than switch/case. Having said that, if there are multiple chunks of data that you need to access and they were created/loaded apart from each other then it’s just as likely to cause cache issues. This is why I think C++ OOP or structs are still viable since the data that are likely to be worked on at the same time are more likely to be cached together as well.

I do think that if your linked list is created at a single load time, then the data in it should be pretty near localized (especially if you’re doing asset sharing to reduce node sizes). Adding and removal of objects over time would of course degrade that caching, but sorting should be safe.

Honestly with massive changes that have occurred in hardware in this last decade, a better option than asking randos on the internet to answer these questions is to write code to test these things on your own system.

the title is right with the topic for main discussion about data structure.

Thank you for letting me watch it

sure. additionally, I categorize memories when I allocate them for giving same categorized memories to same list.

hmm… alright I ll do my best