microsoft / MixedRealityToolkit-Unity

This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity
https://aka.ms/mrtkdocs
MIT License
6k stars 2.12k forks source link

Perf regression in UpdateLineVisuals #11343

Closed Zee2 closed 1 year ago

Zee2 commented 1 year ago

This issue has been migrated a new MRTK repository, and the status of this issue will now be tracked at the following location:


Describe the bug

MRTKLineVisual.UpdateLineVisual is allocing 2 KB every frame, even when no hands are even visible in the scene.

image

To reproduce

Open empty MRTK scene. Run scene. Check profiler.

Expected behavior

No per frame alloc, especially not when the rays are even visible!

Your setup

RogPodge commented 1 year ago

Digging into this issue also revealed that we'd get a bunch of gc alloc costs when active holding a selection on an object in the input simulator. This is because our selection value would never quite hit 0 or 1. The PR #11344 adds a deadzone to the input simulator to allow the axis value to finally reach the target value of 0 or 1.

shaynie commented 1 year ago

Tested - no repro. No per frame allocations now. Looks like the above fix worked.