[DevTools] add perf regression test page in shell #25078
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a "perf regression tests" page to react-devtools-shell. This page is meant to be used as a performance sanity check we will run whenever we release a new version or finish a major refactor.
Similar to other pages in the shell, this page can load the inline version of devtools and a test react app on the same page. But this page does not load devtools automatically like other pages. Instead, it provides a button that allows us to load devtools on-demand, so that we can easily compare perf numbers without devtools against the numbers with devtools.
As a first step, this page currently only contain one test: mount/unmount a large subtree. This is to catch perf issues that devtools can cause on the react applications it's running on, which was once a bug fixed in #24863.
In the future, we plan to add:
How did you test this change?
In order to show this test app can actually catch the perf regression it's aiming at, I reverted #24863 locally. Here is the result:
devtools-regression-with-revert.mov
As shown in the video, the time it takes to unmount the large subtree significantly increased after DevTools is loaded.
For comparison, here is how it looks like before the fix was reverted:
about the
requestAnimationFrame
methodFor this test, I used
requestAnimationFrame
to catch the time when render and commit are done. It aligns very well with the numbers reported by Chrome DevTools performance profiling. For example, in one run, the numbers reported by my method areThey are very close to the numbers reported by Chrome profiling:
<Profiler>
is not able to catch this issue here.If you are aware of a better way to do this, please kindly share with me.