I’m working on an object pool solution.
I’m trying to benchmark different implementations by isolating the spawn and despawn methods, but the numbers seem a little low.
So I think I might be doing something wrong with the timing.
Essentially, I’ve made a temporary Update() function that spawns 1000 cubes and then despawns them, recording the times for the operation.
On frame 60:
Stopwatch.Start()
1000 cubes are spawned
Stopwatch.Stop()
record Stopwatch.EllapsedMilliseconds
On frame 120:
Stopwatch.Reset()
Stopwatch.Start()
1000 cubes are despawned
Stopwatch.Stop()
record Stopwatch.EllapsedMilliseconds
The times I’m getting are:
No collider, no rigidbody: 3+2 = 5 milliseconds
collider, no rigidbody: 4+3 = 7 milliseconds
no collider, rigidbody: 5+4 = 9 milliseconds
collider, rigidbody (spaced): 8+5 = 13 milliseconds
collider, rigidbody (overlapping): 8+7 = 15 milliseconds
Does this look like realistic performance? Is my methodology flawed?