Working on a test scene, am seeing widely disparate performance issues on the same build, depending on when it is launched somehow…
The sample scene has a basic consistent physics interaction; nothing is spawned or Instantiated to explain the inconsistency.
When it does not run well (for some yet unknown reason):
iPhone Unity internal profiler stats:
cpu-player> min: 273.9 max: 311.8 avg: 280.4
cpu-ogles-drv> min: 4.3 max: 6.8 avg: 5.0
cpu-present> min: 1.8 max: 4.7 avg: 2.3
frametime> min: 284.2 max: 317.1 avg: 295.5
draw-call #> min: 11 max: 15 avg: 11
tris #> min: 4878 max: 5058 avg: 4893
verts #> min: 3377 max: 3737 avg: 3408
player-detail> physx: 18.7 animation: 0.1 skinning: 0.0 render: 5.4 fixed-update-count: 14 .. 15
mono-scripts> update: 232.8 fixedUpdate: 19.8 coroutines: 1.2
mono-memory> used heap: 1785856 allocated heap: 2076672
Same build (no changes in code, just relaunching), when it runs well (every 4-7 launches):
iPhone Unity internal profiler stats:
cpu-player> min: 15.8 max: 28.6 avg: 20.8
cpu-ogles-drv> min: 6.8 max: 11.4 avg: 8.9
cpu-present> min: 1.5 max: 5.9 avg: 2.1
frametime> min: 31.2 max: 46.5 avg: 38.1
draw-call #> min: 13 max: 15 avg: 13
tris #> min: 4914 max: 4950 avg: 4929
verts #> min: 3449 max: 3521 avg: 3479
player-detail> physx: 3.7 animation: 0.0 skinning: 0.0 render: 7.9 fixed-update-count: 1 .. 3
mono-scripts> update: 4.3 fixedUpdate: 3.4 coroutines: 0.5
mono-memory> used heap: 966656 allocated heap: 1159168
Note the huge drop in ‘mono-scripts’ cycles; this is the same build, simply re-launched run, each time with no user interaction no rebuild between launches.
This disparately occurs whether the build is launched from XCode or from the device itself. Rebooting the device doesn’t seem to affect it in any reliable way; runs well once, then doesn’t run well for a while, then does again.
Imagine is due to some memory / garbage-collection issue. Anyone have any thoughts on this? More importantly, how to mitigate the issue?