3 ms·
I believe that the main problem is not allocation time (games already have loading times, that's not a problem), but fast access and not breaking the cache.
by svalorzen 11y ago
I believe that the main problem is not allocation time (games already have loading times, that's not a problem), but fast access and not breaking the cache.
- jzwinck 11y agoThe title of the first slide in the video is "Heap allocations are expensive!" And using a pool the way I'm proposing does not fragment the heap. It might be slightly worse if you serially touch a lot of Meshes which have only a few vertices and edges each, but this is a corner case and a trade-off anyway.
- slavik81 11y agoMeshes are typically quite big. Moving two small blocks of data together helps to improve cache behaviour as the two blocks can then fit in a single cache line. Moving two giant blocks of data closer together is not going to make much difference, because they probably span hundreds or thousands of cache lines anyways.