Implement a generic equality check for unmanaged types that doesn't cause them to be boxed.
Leveraging this allows the assertion in AccessController to execute without any managed allocations.
What is the current behaviour?
Trying to perform an equality check between JobHandle instances results in boxing. This applies to any value types that don't implement IEquatable<T> or the == operator.
AccessController's assertion produces garbage on every execution.
What is the new behaviour?
UnsafeUtil.Equals_NoBox<T>() provides a way to check the equality between two unamanged instances by directly comparing their memory.
JobHandle.Equals_NoBox provides a way to perform an equality check between two JobHandle instances without boxing.
AccessController's assertion no longer produces garbage.
Implement a generic equality check for
unmanaged
types that doesn't cause them to be boxed. Leveraging this allows the assertion inAccessController
to execute without any managed allocations.What is the current behaviour?
Trying to perform an equality check between
JobHandle
instances results in boxing. This applies to any value types that don't implementIEquatable<T>
or the==
operator.AccessController
's assertion produces garbage on every execution.What is the new behaviour?
UnsafeUtil.Equals_NoBox<T>()
provides a way to check the equality between twounamanged
instances by directly comparing their memory.JobHandle.Equals_NoBox
provides a way to perform an equality check between twoJobHandle
instances without boxing.AccessController
's assertion no longer produces garbage.What issues does this resolve?
What PRs does this depend on?
Does this introduce a breaking change?