Relevant Game Info:
-Isometric-ish. i.e. If there are tiles the majority are empty since there isn't any tile backgrounds.
-Lots of units, lots of bullets, lots of players.
Problem:
I understand that dynamic allocations within the game loop are bad for performance, but the units are fairly dynamic (or should be when I am farther along).
Right now there is a stl::vector<> holding pointers to a base class of all units. Iteration is fairly nasty with large numbers of units.
Solution:
Have a large pool of memory for units preallocated. Copy new units over and use a bitvector to manage which slots are used and which slots are empty. Have secondary indexes on this list for optomized traversal.
Does this sound like it would work? Has anyone done anything similar? Am I wasting my energy and my time for a marginal performance boost?
[One might notice I never mentioned what performance I am getting and what performance I hope for... although it is important I would appreciate it if this aspect was ignored]
Thank you in advance.
------------------
Dark Lord Pi