I’m considering migrating a first person shooter project I’ve been working on for the past several years (custom engine) to jmonkeyengine. After a quick review of the structure and api, it looks to have everything I require, AND is very simple and easy to understand.
One thing I’m hoping someone could confirm for me though is JVM tuning and optimization ability (if it were ever to be required). I’ve written and supported a few java web applications in the past, but have never had to dig too deep into how the JVM manages memory, or do any custom tuning myself, therefore I’m unsure of how easy/difficult it would be to ship a finished game and have the optimizations take effect on a user’s installed jvm, or if rather you would want to package a jvm with the production release?
I simply need to know that if I sink months worth of time into a prototype and discover that there are micro glitches due to GC, that I would have some avenue to be able to smooth these out.
I understand that if I follow best practices and write optimized code that this will probably not be an issue, and I may be concerned for no reason…I just want to confirm that if I get to the level of requiring JVM optimizations to accomplish something, that it’s possible.
The only thing that I have seen make a difference (and not a very big one) is to use the shenandoah gc. The key reason for this is it has several optimizations for jni calls, which JME uses LWJGL, which in turn is just a wrapper around thousands of jni calls. In theory one may gain from 1 to 2 ns of performance per jni call. And depending on the number of jni calls in a frame, this may become a slight optimization. But keep in mind, any optimization done at this level will have little difference compared to optimizations at your code level. Also using a newer JDK usually helps with performance. For example, using JDK 17 over 11.
EDIT: Spasi, who is the maintainer of LWJGL has some benchmarks for different GCs with JNI calls buried somewhere in one of the many jdk mailing lists. I did not find it from a quick search, but perhaps someone has a quick link to it on hand.