IN GENERAL, is it considered to be a bad idea to perform allocations (the “new” keyword) during the rendering loop of a game? Would be be a better idea to pool/recycle objects such as vectors and positions, or keep everything in terms of raw x/y coordinates? Or is the performance gain from all of this not worth the decrease in code simplicity/readability? Especially if I have the intention to someday port a game to Android, where less memory would be available. I realize this is perhaps an overly generalized question but I’m curious as to how many people pursue this kind of optimization.
On desktop, this is not a problem, on android, this is a bigger problem.
It is not entirely clear that in every circumstance that the “optimizations” you list result in performance gains. If you are worrying in particular about the GC, there are ways to tune it to optimize for the prevention of pauses.
http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html