Closed orlof closed 10 years ago
You are not required to use component pooling if you don't wish to. You can simply create an Artemis World with a custom component manager that doesn't do any pooling.
With that said, I've read the SE post that you linked. None of the responses mention game development as an application, but talk about Java for the general use case. In high performance environment of gaming, especially that in the mobile world, Garbage Collection can wreak havoc on game performance. I've seen the frame rate drop down quite significantly when Android GC decides to make a round.
In adding pooling to gdx-artemis, I mostly followed recommendations of libgdx and this book: http://www.amazon.com/Beginning-Android-Games-Mario-Zechner/dp/1430246774. It's written by the author of Libgdx. (I really recommend this book if you decide to pursue Android game development. It's a great basic introduction.)
If you are not developing for mobile, perhaps memory allocation and Garbage Collection will not be a big deal. However, personally I prefer to avoid Garbage Collection as much as possible to keep my games running smoothly.
Here's another post that talks about this very issue:
PS This is also the reason I use libgdx containers rather than java native ones. They are a lot more memory efficient.
Thank you for the very informative response. I am not developing for any mobile platforms, but I will study the links you mentioned.
This is not an issue, but a question.
Do you have any performance data whether component pooling actually increases performance? The consensus in SO seems to be against it. E.g.
http://programmers.stackexchange.com/questions/115163/is-object-pooling-a-deprecated-technique