-
Notifications
You must be signed in to change notification settings - Fork 28
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
feat: detect unnecessary render and warn user #468
feat: detect unnecessary render and warn user #468
Conversation
🦋 Changeset detectedLatest commit: 6c6f88c The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
I found something very interesting while testing the implementation @mdjastrzebski For
with setTimeOut
|
Another thing I came up with while testing is currently screen variable has been set in the outer scope. On the first render screen variable is not set yet. On the second I am not sure I am missing any point you have described on the discussion issue @mdjastrzebski |
@guvenkaranfil good first step. As a next step you should probably modify |
@mdjastrzebski I've just updated the implementation based on capturing component representations into an array and compare after.
Why not we would like to do comparison after 1st run instead of like end of the test like |
@guvenkaranfil The comparison can be made after all runs, that is not that important. The important factors are:
|
@mdjastrzebski Have you had a chance to look updated parts 🤔 |
@guvenkaranfil Thanks for your patience. I'll try to check it soon. |
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.
Looks like you are going in the good direction. I've suggested some tweaks to actual format of rendundantRenders
object, as well as moving things around a bit.
Next step would be to extend the Markdown and Console reports to include info about rendundant re-renders (both initial and updates).
Hello @mdjastrzebski, thanks for detailed feedback. I will follow up your comments and update accordingly. I believe with latest addition we show redundant render information both initial and update. |
@mdjastrzebski Should we separate including redundant render information into markdown by types |
Hi @mdjastrzebski, I believe it is better to put |
59e0672
to
3621b8d
Compare
58ab314
to
e085e6c
Compare
@brandon-gs I am still polishing the UX & implementation around it. Probably still need around a week or two. BTW this feature would be released as part of 1.0.0 (perhaps as RC release). |
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.
LGTM
Performance Comparison Report
Significant Changes To Duration
Show details
Meaningless Changes To DurationShow entries
Show details
Render Count ChangesThere are no entries Render Issues
Added Scenarios
Show details
Removed Scenarios
Show details
|
🎉 This PR has been released in v1.0.0-rc.5 🎊 |
* refactor: rename `meassurePerformance` to `measureRenders` (#433) * chore: v1.0.0-beta * docs: update changelogs * docs: migration guide * chore: update snapshots * chore: update node ver on GH * chore: v1.0.0-rc * chore: v1.0.0-rc.1 * chore: reorganize repo deps (#477) * refactor: migrate deps * chore: dedup eslint * chore: fix eslint deps * chore: yarn berry (#478) * chore: yarn berry (wip) chore: forward reassure cli in the main package chore: remove --force chore: fix ci chore: fix ci chore: fix typecheck chore: fix danger chore: fix danger chore: fix ci chore: fix danger refactor: tweaks * chore: workspace deps * chore: add changeset * chore: v1.0.0-rc.2 * chore: fix versions * chore: fix version deps between packages * chore: v1.0.0-rc.3 * fix: iso date milliseconds regex (#481) * chore: check deps consistency (#482) * chore: pdate deps 2024-05-09 (#484) * chore: update deps * chore: fix lint * chore: update danger (#483) chore: update danger.js * chore: upgrade RN / test app (#485) * chore: upgrade turbo * chore: update React Native / test app * chore: fix wasm error * chore: updata other deps (#486) * chore: update other deps * chore: update peer deps * chore: update deps * feat: enable wasm by default (#488) * chore: tweak workflow (#490) * chore: tweak workflow * chore: update docs * chore: export types (#489) * chore: export types * chore: gen yarn.lock * chore: tweaks docs * refactor: rename types * chore: add docs * chore: clean scripts (#491) * chore: clean scripts * chore: tweak turbo * chore: add missing changeset * chore: v1.0.0-beta.4 * chore: regenerate yarn.lock * feat: detect unnecessary render and warn user (#468) * feat: detect unnecessary render and warn user feat: capture json representations in an array to compare after for unnecessary rendering fix: get current testingLibrary for comparasion only react-native for now fix: save json representation instead of string for rendered component state and compare changes between states using dfs fix: test name fix: update comparasion function and save compare results into output.json and show comparation results in the end of the test fix: update interface and variable names based on pr recommendatations chore: rebase to v1 * refactor: improve output formatting * refactor: fix typo * refactor: remove unnecessary warning * refactor: improve testing * refactor: improve report criteria * refactor: improve naming * refactor: improve code structure & tests * refactor: tweaks * feat: improve markdown output * refactor: custom tree comparer * refactor: clean up code * refactor: update JSON structure * refactor: use "initial update count" naming * chore: fix lint * chore: improve tests * refactor: tweaks * docs: update * refactor: self code review * docs: tweaks * chore: add changeset * refactor: final tweaks --------- Co-authored-by: Guven Karanfil <[email protected]> Co-authored-by: Maciej Jastrzebski <[email protected]> * chore: v1.0.0-rc.5 * chore: fix yarn.lock * chore: fix reassure-tests.sh --------- Co-authored-by: Güven Karanfil <[email protected]> Co-authored-by: Guven Karanfil <[email protected]>
Summary
This draft PR is intended to start providing a way to detect unnecessary renders as described here
Test plan
I have added a test file called
UnneccassaryRender.perf-test
which is intended to unnecessarily render on the component and see the warning