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 unnecessary delegate/closure allocations in UIElementAutomationPeer #10691

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

Conversation

h3xds1nz
Copy link
Member

@h3xds1nz h3xds1nz commented Apr 1, 2025

Fixes #10676

Description

Avoids unnecessary delegate/closure allocations in UIElementAutomationPeer by passing the argument via ref instead for this recursive iterator function, allowing to use a static lambda instead.

I've also used the instance over static factory method for CreateAutomationPeer to avoid the unnecessary null check that we've performed right before calling this method, further improving perf on this hot path.

Since the implementation is same for UIElement3DAutomationPeer, I've shared it.

Customer Impact

See #10676 for impact of this change.

Regression

No.

Testing

Local build, verifying that peers are still created.

Risk

Low.

Microsoft Reviewers: Open in CodeFlow

@h3xds1nz h3xds1nz requested review from a team as code owners April 1, 2025 20:43
@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 Apr 1, 2025
Copy link

codecov bot commented Apr 1, 2025

Codecov Report

Attention: Patch coverage is 0% with 42 lines in your changes missing coverage. Please review.

Project coverage is 11.37708%. Comparing base (4aff730) to head (3d5663b).
Report is 5 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #10691         +/-   ##
===================================================
+ Coverage   11.28308%   11.37708%   +0.09399%     
===================================================
  Files           3353        3354          +1     
  Lines         668062      668001         -61     
  Branches       74980       74975          -5     
===================================================
+ Hits           75378       75999        +621     
+ Misses        591433      590754        -679     
+ Partials        1251        1248          -3     
Flag Coverage Δ
Debug 11.37708% <0.00000%> (+0.09399%) ⬆️

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.

@dipeshmsft dipeshmsft self-assigned this Apr 4, 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.

Unnecessary delegate/closure allocations in UIElementAutomationPeer
2 participants