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

Use ReadOnlySpan<HwndWrapperHook> instead of a temporary heap array #10008

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

Conversation

h3xds1nz
Copy link
Contributor

@h3xds1nz h3xds1nz commented Oct 28, 2024

Description

Avoids creation of temporary heap array when initiating HwndWrapper, contributing to startup performance.

  • I've also replaced "" with string.Empty to use singletons in the API calls.
  • I've also modified the hwnd class-name creation to avoid some allocations, logic of course stays the same. (to be honest, the best would be to cache the assembly name in case you're creating multiple windows, since now this needs to be retrieved everytime though Minor Performance Optimization by Reducing Calls to AppDomain.CurrentDomain.FriendlyName #8567 has optimized this to at least be just 1 call per invocation but could be zero after 1st retrieval, really).
  • Tons of unnecessary usings from touched files were removed.
  • Also removes HWND struct as a bonus (one of many, this one is unsed and also not particularly perfect).

Customer Impact

Increased performance, decreased allocations.

Regression

No.

Testing

Local build, app run.

Risk

Low.

Microsoft Reviewers: Open in CodeFlow

@h3xds1nz h3xds1nz requested review from a team as code owners October 28, 2024 15:58
@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 Oct 28, 2024
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