mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Stop Unnecessary Purging of Node Cache
When each component unmounts, it already cleans up its respective entry in the node cache. Let's stop blowing away the entire node cache unnecessarily. This should improve performance because a React component's root will never need to be searched for more than once.
This commit is contained in:
committed by
Paul O’Shannessy
parent
ee1335b6a2
commit
10dab495f2
@@ -161,7 +161,6 @@ var ReactDOMIDOperations = {
|
||||
dangerouslyReplaceNodeWithMarkupByID: function(id, markup) {
|
||||
var node = ReactID.getNode(id);
|
||||
DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
|
||||
ReactID.purgeEntireCache();
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -171,7 +170,6 @@ var ReactDOMIDOperations = {
|
||||
manageChildrenByParentID: function(parentID, domOperations) {
|
||||
var parent = ReactID.getNode(parentID);
|
||||
DOMChildrenOperations.manageChildren(parent, domOperations);
|
||||
ReactID.purgeEntireCache();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -158,16 +158,8 @@ function purgeID(id) {
|
||||
delete nodeCache[id];
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the entire cache.
|
||||
*/
|
||||
function purgeEntireCache() {
|
||||
nodeCache = {};
|
||||
}
|
||||
|
||||
exports.ATTR_NAME = ATTR_NAME;
|
||||
exports.getID = getID;
|
||||
exports.setID = setID;
|
||||
exports.getNode = getNode;
|
||||
exports.purgeID = purgeID;
|
||||
exports.purgeEntireCache = purgeEntireCache;
|
||||
|
||||
Reference in New Issue
Block a user