Reputation: 21778
I used to read various blogs and recommendations that pooling normal Java objects (not objects like connections or the like) does not improve and may actually decrease the performance, being an anti-pattern. However this is much less common to hear about the Android platform, and many gaming libraries, for instance, provide classes for reusing existing objects. Now I read that object pooling reduces the number of the garbage collection cycles, improving the performance.
How is a desktop computer so different from the mobile device that a different development pattern is recommended? The probable answers could be
Upvotes: 1
Views: 64
Reputation: 75426
Android is different from oracle Java and what you ask is due to the underlying virtual machine having very different characteristics.
Essentially the Hotspot JVM uses lots of memory to gain speed. Android hardware seldom allows that so objects are much more expensive to make on android than in oracle java (and apparently reflection is slow too).
Upvotes: 1