The library for web and native user interfaces.
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.
Tim Yung committed
Jul 10, 2013 at 14:45 UTC
10dab495f296fcef5a8b6afb380e91c57c134d59
2 files changed
-10
src/core/ReactDOMIDOperations.js
-2
@@ -161,7 +161,6 @@ var ReactDOMIDOperations = {
161
dangerouslyReplaceNodeWithMarkupByID: function(id, markup) {
162
var node = ReactID.getNode(id);
163
DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
164
- ReactID.purgeEntireCache();
164
},
165
166
/**
@@ -171,7 +170,6 @@ var ReactDOMIDOperations = {
170
manageChildrenByParentID: function(parentID, domOperations) {
171
var parent = ReactID.getNode(parentID);
172
DOMChildrenOperations.manageChildren(parent, domOperations);
174
- ReactID.purgeEntireCache();
173
}
174
175
};
src/core/ReactID.js
-8
@@ -158,16 +158,8 @@ function purgeID(id) {
158
delete nodeCache[id];
159
}
160
161
-/**
162
- * Clears the entire cache.
163
- */
164
-function purgeEntireCache() {
165
- nodeCache = {};
166
-}
167
-
161
exports.ATTR_NAME = ATTR_NAME;
162
exports.getID = getID;
163
exports.setID = setID;
164
exports.getNode = getNode;
165
exports.purgeID = purgeID;
173
-exports.purgeEntireCache = purgeEntireCache;