by quadcore · 4y ago · 0 comments
In the game industry, we use contiguous-allocated intrusive free list memory pools. For enemies or projectiles as an example. Those things live and die (they are removed from the free list and inserted in the "live" list or put back in the free list when they die) in such a way the locality is kept good.
Admitedly I dont have sources nor benchmarks and never did. But its obvious it at least invalidates author's point in the sense that benchmarks gota be done in real life programs.
When performance needs to be maximized, games switch to entity component systems and switch from arrays-of-structs to structs-of-arrays. This enables processing all objects as a vector, linearly from start to end, and often without needing to fetch any irrelevant bytes that aren't processed in a given pass. This sometimes also helps utilize SIMD for data spanning more than one entity, which you can't do when using linked lists.
If you use them as a single-linked free list they are faster than a vector since you only need to fetch a cache line for the object rather than a cacheline for the object and one for the vector storing free objects.