Describe the bug
While profiling our application I found about 4 execution paths that all resulted in calling FocusProvider.GetPointers, which currently generates garbage every frame (1KB in our case)
|
public IEnumerable<T> GetPointers<T>() where T : class, IMixedRealityPointer |
|
{ |
|
List<T> typePointers = new List<T>(); |
|
foreach (var pointer in pointers.Values) |
|
{ |
|
T typePointer = pointer.Pointer as T; |
|
if (typePointer != null) |
|
{ |
|
typePointers.Add(typePointer); |
|
} |
|
} |
|
|
|
return typePointers; |
|
} |
While this can be simplified in not creating a list everytime, is it possible or even required to get rid of gc altogether?
public IEnumerable<T> GetPointers<T>() where T : class, IMixedRealityPointer
{
foreach (var pointer in pointers.Values)
{
T typePointer = pointer.Pointer as T;
if (typePointer != null)
{
yield return typePointer;
}
}
}
Describe the bug
While profiling our application I found about 4 execution paths that all resulted in calling FocusProvider.GetPointers, which currently generates garbage every frame (1KB in our case)
MixedRealityToolkit-Unity/Assets/MRTK/Services/InputSystem/FocusProvider.cs
Lines 884 to 897 in 06a0677
While this can be simplified in not creating a list everytime, is it possible or even required to get rid of gc altogether?