-
Notifications
You must be signed in to change notification settings - Fork 50.4k
Wrap lifecycle events with ReactPerf.measure if __DEV__ #4522
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
Conversation
|
You posted a self-referential link back to this pull request; I assume you intended to link to: #4521 The unit tests aren't passing, as per Travis. Conceptually this feature seems reasonable to me but we should confirm with @spicyj and @sebmarkbage |
|
@jimfb - looking into the tests now. I'm hijacking the lifecycles so where they're re-attached might be the issue. |
|
@jimfb - sorry for the delay in getting to look at this. Travis is kosher now. Would love for some feedback on this. If my description of the PR isn't clear just let me know. |
|
This is only wrapping it in ReactClass which doesn't work with ES6 classes etc. It should be done in CompositeComponent if anything. However, I'm not sure if these necessarily are makes sense as part of ReactPerf or some more complete profiling solution. |
|
Yea I originally was going to break it up into smaller PRs. I'll just submit all of it at once. George
|
|
@sebmarkbage - I'm looking through implementing these features onto ReactCompositeComponent instead. Trouble I'm seeing is that only the methods defined on RCC are running through ReactDefaultPerf i.e. _renderValidatedComponent, updateComponent, mountComponent, etc. So trying to hijack the will look into this more. most likely will close this PR and issue and take different approach |
In order to do more advanced metrics with ReactPerf, ReactDefaultPerf, etc. we really need to have those being run through the measure cycle as well as renders.
This will allow for more advanced metrics like
# of times should component update called per component, etc.Ultimately, would like to see React pump out warnings for things like
component has no state or props and no shouldComponentUpdateorshouldComponentUpdate always returns true/false.Seems like this would be much more impactful if baked into core rather than having to write additional 3rd-party tools to hijack ReactComponents to measure them.