Object pool performance impact

EVG

Member
Does the pool of objects, if there are many of them, have any effect on performance or memory consumption on mobile devices?
 

Attachments

  • objpl.png
    objpl.png
    73.6 KB · Views: 10
The idea of any object pool, which I suggest to google if not familiar, is to reduce spike and memory consumption, by reusing objects rather than destroying and re-instantiating. The more in the pool the more memory used but still less garbage than doing it by instantiate and destroy. At a glance at your screenshot, maybe you have added as many as you put in the scene? Basically you only need the amount that will be instantiated and consumed at any one time... will you be picking up the same pear pickup 10x? If not then only one should really be preloaded. If your going to have a mass amount of bullets going, add the amount you feel it'd need to start without spike firing all at once(also think of deactivation time). The pool in UCC is awesome, it will grow as need be if you don't get it bang on. Just experiment with what you feel the game will need at any one point of time.
 
The idea of any object pool, which I suggest to google if not familiar, is to reduce spike and memory consumption, by reusing objects rather than destroying and re-instantiating. The more in the pool the more memory used but still less garbage than doing it by instantiate and destroy. At a glance at your screenshot, maybe you have added as many as you put in the scene? Basically you only need the amount that will be instantiated and consumed at any one time... will you be picking up the same pear pickup 10x? If not then only one should really be preloaded. If your going to have a mass amount of bullets going, add the amount you feel it'd need to start without spike firing all at once(also think of deactivation time). The pool in UCC is awesome, it will grow as need be if you don't get it bang on. Just experiment with what you feel the game will need at any one point of time.
I understand how it works. And yes, some objects can appear in the scene with up to 30 instances. And so the question is, by creating so many objects in the pool, will it hurt more than it will help? It is on mobile platforms.
 
You'll pay the instantiation cost during the scene load rather than when the object is used during the game so it will help more than hurt. Just make sure you don't have an unreasonable number of pooled objects instantiated at the beginning.
 
Top