https://bugs.webkit.org/show_bug.cgi?id=148080
Reviewed by Antti Koivisto.
Add performance tests for traversal of *uncached* collections returned
by getElementsByClassName() / getElementsByTagName(). These methods
will soon be updated to return an HTMLCollection instead of a
NodeList and we need to make sure we don't regress performance in the
process.
* DOM/get-elements-by-class-name-traversal-uncached.html: Added.
* DOM/get-elements-by-tag-name-traversal-uncached.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188547
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-08-17 Chris Dumez <cdumez@apple.com>
+
+ Add performance tests for traversal of collections returned by getElementsByClassName() / getElementsByTagName()
+ https://bugs.webkit.org/show_bug.cgi?id=148080
+
+ Reviewed by Antti Koivisto.
+
+ Add performance tests for traversal of *uncached* collections returned
+ by getElementsByClassName() / getElementsByTagName(). These methods
+ will soon be updated to return an HTMLCollection instead of a
+ NodeList and we need to make sure we don't regress performance in the
+ process.
+
+ * DOM/get-elements-by-class-name-traversal-uncached.html: Added.
+ * DOM/get-elements-by-tag-name-traversal-uncached.html: Added.
+
2015-08-14 Chris Dumez <cdumez@apple.com>
Add performance tests for NodeList and HTMLCollection traversal
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../resources/runner.js"></script>
+<script>
+function runTest() {
+ PerfTestRunner.measureRunsPerSecond({
+ description: "This benchmark covers 'getElementsByClassName'.",
+ run: function() {
+ var testDocument = document.getElementById("testFrame").contentDocument;
+ for (var i = 0; i < 10; i++) {
+ var elements = testDocument.getElementsByClassName("example");
+ // Do not access length so that we do not cache the elements.
+ var j = 0;
+ while (elements.item(j++)) { }
+ }
+ }
+ });
+}
+</script>
+</head>
+<body onload="runTest()">
+<iframe id="testFrame" src="../Parser/resources/html5.html" style="display:none" sandbox></iframe>
+</body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../resources/runner.js"></script>
+<script>
+function runTest() {
+ PerfTestRunner.measureRunsPerSecond({
+ description: "This benchmark covers 'getElementsByTagName'.",
+ run: function() {
+ var testDocument = document.getElementById("testFrame").contentDocument;
+ for (var i = 0; i < 10; i++) {
+ var elements = testDocument.getElementsByTagName("p");
+ // Do not access length so that we do not cache the elements.
+ var j = 0;
+ while (elements.item(j++)) { }
+ }
+ }
+ });
+}
+</script>
+</head>
+<body onload="runTest()">
+<iframe id="testFrame" src="../Parser/resources/html5.html" style="display:none" sandbox></iframe>
+</body>
+</html>