-
Notifications
You must be signed in to change notification settings - Fork 23
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
[FEATURE] Detect unnecessary renders #225
Comments
This has a potential to increase to test duration significantly. I'd also consider adding a CLI flag, so it can be done from command line once in a while |
Yes, and also there could be some technical difficulties with that. As I haven't done POC for that. But we would still award any meaningful progress with |
One idea not to affect the test duration too much would be to perform this check only during a single run. That make sense assuming that test scenarios are deterministic and do not have variable render patterns from time to time. We could either do additional non-measured run and/or use the first run which we already discard from the results. |
An additional run sounds great actually, as you said doesn't have to be measured. |
I love the idea. I was looking for optimization one of the client app and found there was so unnecessary re-render. So I could write a performance test to measure and get the time result. But as far as I can see I can not see an option to check that item of the list is rendering unnecessarily @mdjastrzebski I also open up another feature issue with a repository sample |
I've started to investigate how to implement the feature. measureRender function contains the You were thinking implementing logic inside measureRender function right @mdjastrzebski |
@guvenkaranfil This is the part which would need a separate React.js vs RN flow.
|
@guvenkaranfil In the v1 of implementation you could target either RN or React.js. We could developer this feature for each platfrom separately. |
I opened up a draft PR to forward potential solutions from the code here is the PR @mdjastrzebski |
Is your feature request related to a problem? Please describe.
This would be an optional feature activated by
measurePerformance
option on per test level andconfigure
option on global level. Option name could bedetectRedundantRenders
or something similar.When turned on, measuring code would analyze the rendered output and notify user if render did result in the same user interface being generated, i.e. that render was redundant.
Describe the solution you'd like
When turned on, after each
onRender
callback fromReact.Profiler
component measuring code would run.toJSON
method from RNTL/RTL in order to generate host component representation of the output. Next it would compare the output with similar output generated on previousonRender
callback and warn user if the output is the same, meaning that the render did not cause change to the host component representation of the UI, i.e. UI did not change.The text was updated successfully, but these errors were encountered: