Optimization reference

This page is intended as a reference collection of optimization tricks that can be used to speed up JME3 applications.

Maintain low Geometry count

The more Geometry objects are added to the scene, the harder it gets to handle them in a speedy fashion. The reson for this is, that for every object a render command must be done, here is a bottleneck betwenn the CPU and the Graficcard. Possible optimization techniques

Side-effects

Avoid creating new objects

When you use math operations like vectorA.mult(vectorB); new objects are created that have to be garbage collected when you don't use them anymore. Check your math operations for opportunities to use the local version of the math operations, e.g. vectorA.multLocal(vectorB). This way the result is stored in vectorA and no new object needs to be created.

Check the Statistics

SimpleApplication displays a HUD with statistics. Use app.setDisplayStatView(true); to activate it, and false to deactivate it. It counts how many FrameBuffers, Textures, or Shaders…

Example:

Genereally jME3 is well optimized and optimizes these things correctly. The normal state is that the (S/F/M) values should be in the same order of magnitude; (S) values can be lower than (F).

performance

view online version