haikuwebkit/PerformanceTests/DOM/TraverseChildNodes.html

33 lines
1.1 KiB
HTML
Raw Permalink Normal View History

Remove NodeListsNodeData when it's no longer needed https://bugs.webkit.org/show_bug.cgi?id=107074 Reviewed by Darin Adler. PerformanceTests: Added a micro benchmark to see the benefit of removing NodeListsNodeData. The test traverses all elements in the html5 specification page and accesses childNodes. Don't enable this test for now since it's really a micro benchmark specifically designed to test this patch. * DOM/TraverseChildNodes.html: Added. * Skipped: Don't enable newly added test by default. * resources/results-template.html: Compare against the unscaled unit (e.g. "bytes") as opposed to scaled units such as "K bytes". * resources/runner.js: (.start): Moved the code to call currentTest.setup from measureRunsPerSecondOnce so that it'll be ran for all test types, namely of PerfTestRunner.measureTime. (.measureRunsPerSecondOnce): Source/WebCore: Remove NodeListsNodeData when the last node list is removed from it. If we detect that we have only one node list left in the data structure, we'll simply destroy the entire "this" object to free up the memory space. This reduced the memory usage of the micro benchmark by roughly 3%. Performance Tests: DOM/TraverseChildNodes.html * dom/Node.cpp: (WebCore::Node::clearNodeLists): Added. * dom/Node.h: * dom/NodeRareData.h: (WebCore::NodeListsNodeData::removeChildNodeList): (WebCore::NodeListsNodeData::removeCacheWithAtomicName): (WebCore::NodeListsNodeData::removeCacheWithName): (WebCore::NodeListsNodeData::removeCacheWithQualifiedName): (WebCore::NodeListsNodeData::deleteThisAndUpdateNodeRareDataIfAboutToRemoveLastList): Added. Removes "this" NodeListsNodeData if there is only one node list left. Tools: Generalize the warning a little so that it's also ignored on PerformanceTests/DOM/TraverseChildNodes.html * Scripts/webkitpy/performance_tests/perftest.py: (PerfTest): Canonical link: https://commits.webkit.org/125435@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@140070 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-01-18 00:35:57 +00:00
<!DOCTYPE html>
<html>
<body>
<script src="../resources/runner.js"></script>
<script>
var spec = PerfTestRunner.loadFile("../Parser/resources/html5.html");
var iframe;
PerfTestRunner.measureTime({
setup: function () {
if (iframe)
document.body.removeChild(iframe);
iframe = document.createElement("iframe");
iframe.style.display = "none"; // Prevent creation of the rendering tree, so we only test HTML parsing.
iframe.sandbox = ''; // Prevent external script loads which could cause write() to return before completing the parse.
document.body.appendChild(iframe);
iframe.contentDocument.open();
iframe.contentDocument.write(spec);
iframe.contentDocument.close();
},
run: function() {
var elements = iframe.contentDocument.getElementsByTagName('*');
for (var i = 0; i < elements.length; i++) {
for (var j = 0; j < elements[i].childNodes.length; j++)
elements[i].childNodes[j];
}
},
done: function () { document.body.removeChild(iframe); }});
</script>
</body>
</html>