Title: [110358] trunk/Source/WebCore
- Revision
- 110358
- Author
- [email protected]
- Date
- 2012-03-09 18:22:48 -0800 (Fri, 09 Mar 2012)
Log Message
Improve ContainerNode collectNode() performance by reserving vector
capacity up front.
https://bugs.webkit.org/show_bug.cgi?id=80706
Reviewed by Ryosuke Niwa.
Covered by existing tests. Performance will be evaluated based on
Chromium's page_cycler_bloat-http, page_cycler_intl1, and
dromaeo_domcore suites.
* dom/ContainerNode.cpp:
(WebCore::collectNodes):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (110357 => 110358)
--- trunk/Source/WebCore/ChangeLog 2012-03-10 02:11:43 UTC (rev 110357)
+++ trunk/Source/WebCore/ChangeLog 2012-03-10 02:22:48 UTC (rev 110358)
@@ -1,3 +1,18 @@
+2012-03-09 Stephen White <[email protected]>
+
+ Improve ContainerNode collectNode() performance by reserving vector
+ capacity up front.
+ https://bugs.webkit.org/show_bug.cgi?id=80706
+
+ Reviewed by Ryosuke Niwa.
+
+ Covered by existing tests. Performance will be evaluated based on
+ Chromium's page_cycler_bloat-http, page_cycler_intl1, and
+ dromaeo_domcore suites.
+
+ * dom/ContainerNode.cpp:
+ (WebCore::collectNodes):
+
2012-03-09 Dan Bernstein <[email protected]>
<rdar://problem/11018851> Crash in DisplayRefreshMonitor::notifyClients()
Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (110357 => 110358)
--- trunk/Source/WebCore/dom/ContainerNode.cpp 2012-03-10 02:11:43 UTC (rev 110357)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp 2012-03-10 02:22:48 UTC (rev 110358)
@@ -26,6 +26,7 @@
#include "ChildListMutationScope.h"
#include "ContainerNodeAlgorithms.h"
#include "DeleteButtonController.h"
+#include "DocumentFragment.h"
#include "EventNames.h"
#include "ExceptionCode.h"
#include "FloatRect.h"
@@ -61,8 +62,9 @@
static size_t s_attachDepth;
static bool s_shouldReEnableMemoryCacheCallsAfterAttach;
-static inline void collectNodes(Node* node, NodeVector& nodes)
+static inline void collectNodes(ContainerNode* node, NodeVector& nodes)
{
+ nodes.reserveCapacity(nodes.size() + node->childNodeCount());
for (Node* child = node->firstChild(); child; child = child->nextSibling())
nodes.append(child);
}
@@ -73,7 +75,7 @@
nodes.append(node);
return;
}
- collectNodes(node, nodes);
+ collectNodes(static_cast<DocumentFragment*>(node), nodes);
}
void ContainerNode::removeAllChildren()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes