28-12-2021, 10:39 AM
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:
However, I'm not sure since when exactly Unity supports C# 7.2, so for older versions, a statically allocated array might be due.
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.