Closed Helco closed 9 months ago
With b4b0878e8e62fb8f52f963510afb02414e60ccd7, 919458d5bf95f75c5cc798f0fd9be124c40c23a1 and fd822e19a42aabf157354e29ce326bbaba2702f4 I am going to stop this for now. TreeCollider
is still a big contributor to per-frame allocations but this slowly creeps into performance optimization where different skeletons are hiding (get it, because SkeletonPoseBinding
is the slowest component to compute and render by far 🤓 - yes I will see myself out)
By the time I come back to this we might also have a resource system to pack textures into texture arrays and have modified Vulkan enough to support for Remotery GPU Samples, for now this is good enough.
original Title: Check for regular memory allocations and whether to mitigate themA first quick look revealed that TreeCollider and RangeCollection seem to allocate a lot. Maybe we can use RefLinq to reduce allocations?
When going a couple times between scenes we can observe the garbage collector running almost every frame for a short time. As the GC also sometimes does collections which take 75ms we really have to investigate what kind of per-frame allocations are happening here. (mind that event-based allocations should be fine for now, e.g. talking to a NPC, going between scenes, opening the inventory)
With the .NET Object Allocation Tracking we can see the biggest culprits we should fix for the "Prettify" milestone:
RangeCollection
due to usage ofSortedSet
There are some Unit-Tests but not enough, these should be increased in number and edge-case-coverage before attempting to reduce allocations
TreeCollider
due to heavy LINQ usageNo unit-tests here but we have
TestRaycaster
which should do the trick (also give some informal performance measure)Indexed
and other easy-to-solve LINQ usage, e.g. in the rendering