mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Avoid lastProps[key] lookup in initial render
This makes both Firefox and IE 15-20% faster in initial render (!!). On my PE benchmark, createElement is now on par with HTML in Firefox and faster in IE11 (before, it was slower).
This commit is contained in:
1 parent
6269ef62cf
commit
22a240fd39
1 file changed
+4
-4
@@ -665,7 +665,7 @@ ReactDOMComponent.Mixin = {
|
||||
DOMPropertyOperations.setAttributeForID(el, this._rootNodeID);
|
||||
// Populate node cache
|
||||
ReactMount.getID(el);
|
||||
this._updateDOMProperties({}, props, transaction);
|
||||
this._updateDOMProperties(null, props, transaction);
|
||||
var lazyTree = DOMLazyTree(el);
|
||||
this._createInitialChildren(transaction, props, context, lazyTree);
|
||||
mountImage = lazyTree;
|
||||
@@ -964,9 +964,9 @@ ReactDOMComponent.Mixin = {
|
||||
}
|
||||
for (propKey in nextProps) {
|
||||
var nextProp = nextProps[propKey];
|
||||
var lastProp = propKey === STYLE ?
|
||||
this._previousStyleCopy :
|
||||
lastProps[propKey];
|
||||
var lastProp =
|
||||
propKey === STYLE ? this._previousStyleCopy :
|
||||
lastProps != null ? lastProps[propKey] : undefined;
|
||||
if (!nextProps.hasOwnProperty(propKey) ||
|
||||
nextProp === lastProp ||
|
||||
nextProp == null && lastProp == null) {
|
||||
|
||||
Reference in new issue
Block a user