Skip to content

Unnecessary delegate/closure allocations in UIElementAutomationPeer #10676

@h3xds1nz

Description

@h3xds1nz
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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

PerformancePerformance related issue

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Participants

    @h3xds1nz

    Issue actions

      Unnecessary delegate/closure allocations in UIElementAutomationPeer · Issue #10676 · dotnet/wpf