Proof-of-concept, remove data-reactid and nodeCache, traverse inserted markup immediately #1550
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.
Proof-of-concept implementation complete:
There are some ugly hacks (for simplicity at this point), I mainly provide this PR as a topic for discussion, I intend to rewrite it properly and from scratch, if a consensus is reached.
data-reactid
has been removed from the DOM! Immediately after rendering of markup, it now traverses the DOM nodes and ReactComponents in sync.__reactComponent__
property which holds the ReactDOMComponent instance._rootNode
which holds the DOM node._rootNodeID
still exists but could quite easily be replaced with a monotonic ID (I'm not even sure we need that, but might be useful).nodeCache
has been completely removed, no cache to maintain! Additionally, apart from old browsers possibly leaking memory (IE8/IE9 perhaps?), it is no longer strictly necessary to unmount React from a node I believe, but you really should.style
-object directly as opposed to generating and escaping it.The biggest issue moving forward is tests (if you agree with my findings). This PR breaks pretty much every single test there is (either by API change/deprecation or because they're no longer relevant), it's very likely that we want to leave shims in-place which should allow us to avoid most of the issues for now though.
This PR does not support server-rendering (I think), but it is trivial to fix. We can also get rid of
rootIndex
.Results:
VMIE8: http://i.imgur.com/EPlzmeq.png, http://i.imgur.com/92UdT7K.png
VMIE9: http://i.imgur.com/Q9ya2RY.png, http://i.imgur.com/cYpbxtf.png
VMIE10: http://i.imgur.com/Oh0pB1B.png, http://i.imgur.com/FJJtVvB.png
IE11: http://i.imgur.com/toWaPsS.png
FF: http://i.imgur.com/tmy9UT1.png
Chrome: http://i.imgur.com/m3EMucK.png
The IE8 test is especially interesting because of IE8's simplicity, you can see a significant and consistent performance increase in basically every test.