-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 getClientIdsOfDescendants
and getClientIdsWithDescendants
selectors.
#40054
Optimize getClientIdsOfDescendants
and getClientIdsWithDescendants
selectors.
#40054
Conversation
Size Change: +8 B (0%) Total Size: 1.22 MB
ℹ️ View Unchanged
|
I'm not sure if the performance tests are the ideal way to see the performance of individual functions. I'd consider that more for a larger refactoring where a benchmark isn't possible. For this, the scope is so small that it might be better to benchmark the individual functions, passing in some dummy data and timing how long the functions took (averaged over multiple runs). It could be a fairly homebrew benchmark, just using something like |
Thanks for following up @ZebulanStanphill In my reading of codehealth. the impact of this change on the "focus" metric was about @talldan I'm also not sure that checking the performance of the function directly will give any clue here because there's so many factors (number of times it's called, the arguments, the pre-rendering... ) that can impact the measure. Personally, given that the initial numbers of the "focus" metric in the performance tests of this PR are "promising", I think we should try it. Merge it and monitor the metric over the next commits in trunk. |
What?
This PR (hopefully) optimizes the performance of the
getClientIdsOfDescendants
andgetClientIdsWithDescendants
selectors, to (hopefully) counteract any extra load caused by #39985.This PR also revises the description of
getClientIdsOfDescendants
to properly describe cases where multiple ids are passed to it.Why?
#39985 may have slowed them down a bit.
How?
By using for-of loops, we can avoid creating a bunch of intermediary arrays, which should presumably speed things up a bit.
Testing Instructions
Check the "Performances Tests" in the PR checks, I guess? Not sure how reliable that is, though.