Performance

The key performance measure for Gravity Engine is how many NBody objects can be interacting in a scene. As with all performance questions the answer depends on some key factors:

  • NBody evolution mode (Gravity Engine or Kepler mode)
  • use of OrbitPredictor to show the orbit (and the choice of orbit predictor optimization settings in the GE inspector)
  • choice of integrator (Leapfrog vs Hermite) and the number of steps per fixed update

A set of measurements for GE 6.0 on an i5-7500 @ 3.40GHz with 16GB using Unity 2019.4.1f1 are provided in the table below. These were recorded by running the FrameRateTest scene as an application build. The Leapfrog integrator with default step settings was used.

Note: In the Kepler scenes ALL bodies must be in Kepler mode or marked as FixedObject. This allows GE to skip the N-body main loop and use algorithmic updates.

Some observations:

  1. The maximum number of bodies (6207) is achieved with Kepler objects without orbit predictors. If Orbit predictors are used with the optimization enabled (so the orbit is only computed once) then 1630 bodies can be placed in the scene.
  2. The N^2 growth in gravitational simulations has a strong effect on the number of massive bodies (231 without predictors, 106 with predictors). Using the GE Orbit Predictor interval and load spreading the orbit predictor work over 5 frames results in 196 bodies; close to the no orbit predictor limit.
  3. Massless bodies have similar limits to massive bodies.

ModeOrbit PredictorOrbit Predictor IntervalKepler OptimizationNumber of Bodies
massiveTrue1False106
massiveTrue1False105
massiveTrue1False106
massiveTrue2False152
massiveTrue5False196
masslessTrue1False114
masslessTrue2False160
masslessTrue5False202
keplerTrue1True1630
keplerTrue1False160
keplerTrue2False307
keplerTrue5False682
massiveFalse1False231
masslessFalse1False230
keplerFalse1False6207