Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Garbage from subscribing to collision events
#7
(17-12-2017, 07:37 PM)writer51 Wrote: I just wanted to confirm because I did new benchmarks in a clean project. The new update is massively slower, despite the fact that it removes the garbage collection problem. Thank you for trying to fix this, but my recommendation is not to push this as an update for 3.3. I'm getting about 1/2-1/3 framerate of the old version. Garbage is preferable to that. If you guys have any other ideas please share them, otherwise I guess I will do my best with the regular version for now. 

Tested using collision event handler script included with the package (the commented out part with the color change).

Hi there,

In all our tests, this change makes things run between 5-10% faster than before, to the point that there's no noticeable difference between being subscribed to the collision events or not.
Also there's no reason for it to be slower, as the implementation is basically the same but reusing the same array and resizing it incrementally instead of recreating it from scratch every frame. It still uses an array under the hood (just like List<> does), and iterates over it in the exact same way (not using enumerators or anything, just the [] operator).

Make sure that you're not running with deep profiling enabled, as that does reduce performance by at least 30% in all cases. In some complex scenes, we've seen reductions of up to 80%. This applies to all Unity games. See:
https://docs.unity3d.com/560/Documentati...indow.html

Quote:Note that Deep Profiling incurs a very large overhead and uses a lot of memory, and as a result your game will run significantly slower while profiling.
Reply


Messages In This Thread
RE: Garbage from subscribing to collision events - by josemendez - 17-12-2017, 08:29 PM