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
getClientIdsOfDescendantsandgetClientIdsWithDescendantsselectors, to (hopefully) counteract any extra load caused by #39985.This PR also revises the description of
getClientIdsOfDescendantsto 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.