-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
Fix severe perf problems in component tree devtool #6770
Conversation
One of the ReactMultiChildText tests renders 2145 roots (and even more components) and unmounts none of them. Now we don't loop through them all a bunch of times so the test takes 20 seconds instead of 60. We should clean up instantiateReactComponent somehow so that the onSetDisplayName call isn't produced for the TopLevelWrapper, which should allow us to just store an array of unmountedIDs instead of a hash map so we at least don't have double maps. This change mirrors the old logic though. Reviewers: @gaearon, @sebmarkbage
Lgtm. I will be more careful with perf implications of my code on the existing tests in the future! |
Might not be slow just for tests but maybe all dev code! I did a profile and some of the devtools stuff showed up so it might be good to dig in and see what we can optimize. One idea I have is to make each devtool have a consistent shape. That is, in addDevtool you could do
for every possible event. I think JS VMs will generally be happier about that. |
Yeah. It’s a bit hard with ad-hoc profiling and no agreed way of tracking perf regressions. |
One of the ReactMultiChildText tests renders 2145 roots (and even more components) and unmounts none of them. Now we don't loop through them all a bunch of times so the test takes 20 seconds instead of 60. We should clean up instantiateReactComponent somehow so that the onSetDisplayName call isn't produced for the TopLevelWrapper, which should allow us to just store an array of unmountedIDs instead of a hash map so we at least don't have double maps. This change mirrors the old logic though. Reviewers: @gaearon, @sebmarkbage (cherry picked from commit 3cc733a)
One of the ReactMultiChildText tests renders 2145 roots (and even more components) and unmounts none of them. Now we don't loop through them all a bunch of times so the test takes 20 seconds instead of 60. We should clean up instantiateReactComponent somehow so that the onSetDisplayName call isn't produced for the TopLevelWrapper, which should allow us to just store an array of unmountedIDs instead of a hash map so we at least don't have double maps. This change mirrors the old logic though. Reviewers: @gaearon, @sebmarkbage (cherry picked from commit 3cc733a)
* Add failing tests for facebook#7187 and facebook#7190 * Pass shouldHaveDebugID flag to instantiateComponent This allows us to remove a hack that was added in facebook#6770 and caused facebook#7187 and facebook#7190. * Move logic for choosing whether to use debugID outside instantiate
One of the ReactMultiChildText tests renders 2145 roots (and even more components) and unmounts none of them. Now we don't loop through them all a bunch of times so the test takes 20 seconds instead of 60.
We should clean up instantiateReactComponent somehow so that the onSetDisplayName call isn't produced for the TopLevelWrapper, which should allow us to just store an array of unmountedIDs instead of a hash map so we at least don't have double maps. This change mirrors the old logic though.
Reviewers: @gaearon, @sebmarkbage