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:
- 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.
- 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.
- Massless bodies have similar limits to massive bodies.
Mode | Orbit Predictor | Orbit Predictor Interval | Kepler Optimization | Number of Bodies |
---|---|---|---|---|
massive | True | 1 | False | 106 |
massive | True | 1 | False | 105 |
massive | True | 1 | False | 106 |
massive | True | 2 | False | 152 |
massive | True | 5 | False | 196 |
massless | True | 1 | False | 114 |
massless | True | 2 | False | 160 |
massless | True | 5 | False | 202 |
kepler | True | 1 | True | 1630 |
kepler | True | 1 | False | 160 |
kepler | True | 2 | False | 307 |
kepler | True | 5 | False | 682 |
massive | False | 1 | False | 231 |
massless | False | 1 | False | 230 |
kepler | False | 1 | False | 6207 |