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:
Tim Yung authored and Paul O’Shannessy committed 2013-07-10 15:05:18 -07:00
1 parent ee1335b6a2
commit 10dab495f2
2 files changed
-10

No files matched your search

-2
View File
@@ -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();
}
};
-8
View File
@@ -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;