10-01-2022, 10:32 AM
(28-12-2021, 10:39 AM)pdinklag Wrote: While profiling, I hit on a pretty obvious per-frame GC allocations in the Burst Solver: the padding array in BurstSolverImpl.ApplyConstraints.
The allocation can be avoided by using a stack-allocated span, the number of enum entries is small enough:
Code:Span<int> padding = stackalloc int[Oni.ConstraintTypeCount];
However, I'm not sure since when exactly Unity supports C# 7.2, so for older versions, a statically allocated array might be due.
Thanks for the feedback!
Not sure about C# version support in older (read: < 2020) Unity versions, so will investigate and apply this to the production branch if it all looks clear .