Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid boxing booleans and allocations in UncommonField<bool> #10681

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

h3xds1nz
Copy link
Member

@h3xds1nz h3xds1nz commented Mar 30, 2025

Fixes #10677
Fixes #4114

Description

Even though UncommonField itself is generic, the underlying value storage (EffectiveValues) is not, therefore values saved in uncommon field end up being boxed same way DependencyProperty values are.

A common case is storing a boolean (mostly true), which we can easily special-case using our BooleanBoxes.

While I could fix Unset values for value types, this wasn't originally done so that would be a behavioral change (though it would probably help in some cases to free up some memory).

Customer Impact

See #10677 for impact of this change.

Regression

Depends how you look at it, given the history. But it was boxing in the original, so I guess not.

Testing

Local build, verifying functionality accross different scenarios (GridView, HiearchicalVirtualization via TreeView/VirtualizingStackPanel, etc.)

Risk

Low, this just adds a generic path for bool that is otherwise eliminated.

Microsoft Reviewers: Open in CodeFlow

@h3xds1nz h3xds1nz requested review from a team as code owners March 30, 2025 19:57
@dotnet-policy-service dotnet-policy-service bot added PR metadata: Label to tag PRs, to facilitate with triage Community Contribution A label for all community Contributions labels Mar 30, 2025
Copy link

codecov bot commented Mar 30, 2025

Codecov Report

Attention: Patch coverage is 28.57143% with 10 lines in your changes missing coverage. Please review.

Project coverage is 11.27492%. Comparing base (2a8258a) to head (eb11ad5).

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #10681         +/-   ##
===================================================
+ Coverage   11.25210%   11.27492%   +0.02281%     
===================================================
  Files           3353        3353                 
  Lines         668062      668058          -4     
  Branches       74980       74980                 
===================================================
+ Hits           75171       75323        +152     
+ Misses        591642      591480        -162     
- Partials        1249        1255          +6     
Flag Coverage Δ
Debug 11.27492% <28.57143%> (+0.02281%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Contribution A label for all community Contributions PR metadata: Label to tag PRs, to facilitate with triage
Projects
None yet
1 participant