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

Unnecessary delegate/closure allocations in UIElementAutomationPeer #10676

Open
h3xds1nz opened this issue Mar 30, 2025 · 0 comments · May be fixed by #10691
Open

Unnecessary delegate/closure allocations in UIElementAutomationPeer #10676

h3xds1nz opened this issue Mar 30, 2025 · 0 comments · May be fixed by #10691
Assignees
Labels
Performance Performance related issue

Comments

@h3xds1nz
Copy link
Member

Note that I will submit a PR in the coming days for this issue, so its more of an FYI.

Description

GetChildrenCore and GetRootAutomationPeer both allocate a new delegate and closure each time they execute with the call to iterate function that the callback is passed into. Given that both capture a single local parameter, we can easily just modify the function signature and pass the parameter by ref, saving easily 220 MB in this case.

Showcase

Image

Repro

Note: This repro is specifically crafted to highlight an issue like this.

https://github.com/h3xds1nz/UIAPerformancePitfalls

@h3xds1nz h3xds1nz added the Performance Performance related issue label Mar 30, 2025
@h3xds1nz h3xds1nz self-assigned this Mar 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Performance Performance related issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant