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

Remove array allocation during SystemParametersInfo cache invalidation #10246

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

h3xds1nz
Copy link
Contributor

@h3xds1nz h3xds1nz commented Jan 9, 2025

Description

Removes array allocation during SystemParametersInfo cache invalidation when a theme is changed, saving unnecessary allocation and overhead. We could alternatively keep it in method, while that removes the allocation it won't provide the 10ns execution benefit due to the stack init, and imho there's no reason why it couldn't be outside method, there's no readibility issue.

Method execution difference

Method Mean [ns] Error [ns] StdDev [ns] Gen0 Code Size [B] Allocated [B]
ORIIGINAL 58.89 ns 0.889 ns 0.832 ns 0.0119 424 B 200 B
PR__EDIT 47.03 ns 0.198 ns 0.176 ns - 60 B -

Customer Impact

Improved performance, decreased allocations.

Regression

No.

Testing

Local build.

Risk

Minimal, just getting the data from binary directly instead of heap-allocating an array.

Microsoft Reviewers: Open in CodeFlow

@h3xds1nz h3xds1nz requested review from a team as code owners January 9, 2025 14:09
@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 Jan 9, 2025
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
Development

Successfully merging this pull request may close these issues.

1 participant