Tuned GC Doubles FPS:

Hi all,

i was messing about with my gc arguments, and Ive found if you add those lines:



-Xms12800000 -Xmx256000000



not only does the FPS double, but the startup time is deminished to a millisecond. Also, where previously java.lang.OutOfMemoryError occurs, now it doesn't. Simply because you gave it more memory.

I strongly suggest adding those arguments to your projects/games.

Hope that helps :D

-Xms512m -Xmx512m is easier to read, and adds even more memory (if it’s available).



I generally run all my java apps with these settings (note that I actually have 512Mb of memory, however).



You may also find it helpful to increase your C-code stack size with -Xss1m



-Mike

Be aware though that this also may have the drawback, that once the gc is invoked then, it will have to do more work, depending on the layout of your application.



One of the things that I will attempt in the near future is a profiling run of jme, because I am curious how much time is spent in the engine and how much in the graphics adapter/opengl driver. Maybe after that there will be some conclusions possible on do’s and don’ts like “do not extensively create new objects in the update/render process”. Or it will eventually be clear, that exactly this is not a problem.

There are also some variations on the way the garbage collector runs that can help with performance.



Unfortunately, the settings for the project where I was experimenting with these awhile back were lost when I upgraded Eclipse.



But take a look at the following URL. For real-time games, probably either the Concurrent Low Pause Collector or the Incremental Low Pause Collector are most appropriate.



http://java.sun.com/docs/hotspot/gc1.4.2/



As batman.ac alludes, sometimes reusing an existing object or changing a data structure can result in significant performance changes.

Maybe this link may also help

http://www-106.ibm.com/developerworks/java/library/j-perf05214.html

FWIW, in development, both OptimizeIt and JProbe are used very frequently to discover and squash expensive code in jME. A helpful hints guide though on things that will slow down / speed up your app would make a nice addition to the guide.

So, how does GCJ effect these performance things. I know it’s convienient, but should the GCJ produced exe be quite a bit faster in load and opperation?