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

Reuse bool box objects in UncommonField<bool>.SetValue #6528

Merged
merged 2 commits into from Jun 3, 2022

Conversation

stephentoub
Copy link
Member

@stephentoub stephentoub commented May 4, 2022

Description

In some scenarios, these UncommonFields end up being set very frequently, and each time the value being passed in gets boxed. We can avoid that by caching and reusing a box for each of the only two possible values (though it looks like the default value is almost always false and so it mainly only boxes true).

Customer Impact

Unnecessary allocation

Regression

No

Testing

CI

Risk

Minimal.

Microsoft Reviewers: Open in CodeFlow

In some scenarios, these UncommonField<bool>s end up being set very frequently, and each time the value being passed in gets boxed.  We can avoid that by caching and reusing a box for each of the only two possible values (though it looks like the default value is almost always false and so it mainly only boxes true).
@stephentoub stephentoub requested a review from a team as a code owner May 4, 2022 18:12
@ghost ghost assigned stephentoub May 4, 2022
@ghost ghost added the PR metadata: Label to tag PRs, to facilitate with triage label May 4, 2022
@ghost ghost requested review from dipeshmsft, singhashish-wpf and SamBent May 4, 2022 18:12
@singhashish-wpf
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s), but failed to run 1 pipeline(s).

@dipeshmsft dipeshmsft merged commit 277533f into dotnet:main Jun 3, 2022
@dotnet dotnet locked as resolved and limited conversation to collaborators Jul 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
PR metadata: Label to tag PRs, to facilitate with triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants