Obi Official Forum

Full Version: BurstColliderWorld.GenerateContactsJob Alloc
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, 
Another day another random find when looking through unity's profiler, 
pre-allocating 32 elements in a NativeList removes a lot of alloc work inside the Job, like so (note, example is pretty extreme, 10s of simulations, but it's an 80% cut on standalone build)
[Image: prealloc.png]
Side Note: Value of 32 was chosen at random.
Thanks for sharing this! we don't preallocate in this case to keep baseline memory usage at a minimum (specially on mobile platforms), since the array is allocated for every particle, and many don't have any collisions during most frames. Haven't profiled it in detail though. Will try and find a good compromise between memory and performance, maybe 8 or 16 is good enough.
Nps, glad to be of help. Every win counts, makes the wait for 7.0 a little easier too Lengua