Suggestion / Idea Per-Frame GC Allocation in Burst Solver - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: General (https://obi.virtualmethodstudio.com/forum/forum-5.html) +--- Thread: Suggestion / Idea Per-Frame GC Allocation in Burst Solver (/thread-3251.html) |
Per-Frame GC Allocation in Burst Solver - pdinklag - 28-12-2021 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. RE: Per-Frame GC Allocation in Burst Solver - josemendez - 10-01-2022 (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. 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 . |