Unnecessary allocations in UncommonField<T> for bool
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
_Note that I will submit a PR in the coming days for this issue, so its more of an FYI._
### Description
#4220 attempted to fix this problem but it completely changed the behaviour and so it was reverted (plus, it won't really fix the problem as the values then get boxed during insertion anyways (and it won't prevent insertion due to the fact that most paths are inserting `true` and default is `false`)).
Before it was reverted, in #6528, Stephen added boolean path (it gets compiled only for the `bool` generic paths) which solves the problem for insertions as well, but during the reversal in #7426 this was made useless once again, because you now box during `ReferenceEquals` check, so that optimization is pointless.
My repro is for UIA but the same will occur for HiearchicalVirtualization for example (see #4114).
### Showcase

### Repro
Note: This repro is specifically crafted to highlight an issue like this.
https://github.com/h3xds1nz/UIAPerformancePitfalls
Contributor guide
Assessment
This issue has not been assessed yet.