[UPDATE] Clarified that I have two classes for my bullet. One which uses pooling, and another that does not use pooling.
So my object pooling optimizations don’t seem to be working.
I thought I would have seen some improvements in terms of my performance, but I’m just not seeing it. I think one issue is due to the fact that with more objects lying around, the garbage collector takes longer to run. Essentially, the pooling reduces how often the collector runs, but makes those runs more noticeable.
This is clear when viewing the debug screen within the game. Above, you’ll find a video that I recorded with my performance monitor running. The first clip illustrates the poor performance with pooling, and the second clip is without pooling, where I just instantiate the entities (bullets) and kill them as needed.
You can find my GitHub account here, and the applicable files here are for “bullet” and “pool“.