News for hackers. Stuff that matters.
Re:A Well Known but Forgotten Trick: Object Pooling by deciplex on Wednesday July 29, 2015 @11:02PM (#9972981)
I made a game for Android phones a few years back that would instantiate, at peak, a few thousand agents that would roam around an artificial environment, devouring renewable resources, before (maybe) reproducing and eventually dying off. So these agent instances were being continually created and destroyed, and the GC lag absolutely killed performance and made the game totally unplayable. It was unplayable even on a Galaxy S2 - a reasonably high-performance phone at the time. Once I implemented object pooling to handle the creation and destruction of these agents, the game ran very smoothly on an S2, and I could even run the smaller simulations on an old HTC Magic I had lying around. It made an enormous difference.
Re:A Well Known but Forgotten Trick: Object Pooling by guelo on Wednesday July 29, 2015 @11:15PM (#9973003)
I'm sure twic was referring to the JVM. Android's VM doesn't use a generational collector.
Re:A Well Known but Forgotten Trick: Object Pooling by aidenn0 on Wednesday July 29, 2015 @11:19PM (#9973014)
I'm not from the JVM world, but indeed a generational collector can be a huge boon, particularly if they use a Cheney style collector for the nursery.