-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Optimize GetVisualTreeElementsWindowsInternal #19984
Conversation
Hey there @symbiogenesis! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
784e5cc
to
9ba2780
Compare
Is it possible to add a benchmark for this? In particular, the allocations may be interesting - or maybe no. |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
9ba2780
to
edc475f
Compare
1999fb2
to
e6ddfeb
Compare
447d33e
to
529a500
Compare
529a500
to
9979459
Compare
Benchmarks for latest version that just uses a for loop: Before:
After:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, the new code does look much better (performance-wise) to me!
I'll lean on the MAUI team's knowledge, if we have enough tests to know this doesn't break anything.
Maybe retry the failed jobs? |
There were multiple enumerations occurring in the Windows implementation of GetVisualTreeElements.
Using a HashSet, in particular, for the Contains() check within the other enumeration should especially help speed things up. And adding everything in reverse order in a single enumeration.