-
Notifications
You must be signed in to change notification settings - Fork 47.1k
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
Remove unnecessary indirection and events from the hooks #7464
Conversation
@@ -384,6 +384,7 @@ var NoopInternalComponent = function(element) { | |||
this._renderedOutput = element; | |||
this._currentElement = element; | |||
this._debugID = nextDebugID++; | |||
ReactInstrumentation.debugTool.onInstantiateComponent(this._debugID, element); |
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.
This might also resolve some issues we saw regarding missing elements in stacks
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.
Which were those?
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.
I'm thinking #7240 (comment) and further reports. But not sure if that was related or not.
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.
(y)
Less events is better. onSetDisplayName, onSetOwner, and onSetText only existed because we didn't initially track elements.
onSetText(id, text) { | ||
update(id, item => item.text = text); | ||
onInstantiateComponent(id, element) { | ||
create(id, element); |
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.
This is now the only place where we create entries. All others have been changed to vanilla get
.
This is excellent. I love the create/get separation. |
* Remove unnecessary indirection from the tree hook * Replace onSetDisplayName, onSetOwner, onSetText with one event Less events is better. onSetDisplayName, onSetOwner, and onSetText only existed because we didn't initially track elements. * Remove unused variables (cherry picked from commit 1f31357)
Removing some additional DEV regressions.
This does two things:
onSetOwner
,onSetDisplayName
andonSetText
with one eventWe can do this now easily because we track elements.
This gives me 1.5x improvements in both mounting and unmounting time in DEV.
I tested with https://github.com/gaearon/js-framework-benchmark/tree/master/react-v15.3.0.