s25client
s25client copied to clipboard
Use special allocator for GameEvents
I think we can gain quite some speed by using a special allocator (e.g. a Pool) to serve GameEvents. In the test replays from #1382 at GF 40k there are ~3600 active events and 1 Mio (land) / 2 Mio (sea) events created in total. That is on average between 25-50 Events created per GameFrame. IMO that is massive. E.g. at the same time there are only 30k objects created in total with 12k active.
Using a Pool allocator not only decreases allocation times (special allocation, same sized objects only, memory reuse, ...) it will likely also increase cache utilization as handled events are more likely to be contiguous in memory.
As the Event manager is the only class to create events this is even quite easy.
Possible downside: Leak and use-after-free detection will be harder as the memory will still be "allocated" (from the system view)