Add performance tests for NodeList and HTMLCollection traversal
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Aug 2015 22:11:22 +0000 (22:11 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Aug 2015 22:11:22 +0000 (22:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148043

Reviewed by Gavin Barraclough.

Add performance tests for NodeList and HTMLCollection traversal.
Ideally, those 2 tests should be as fast. However, due to inefficiencies
in our HTMLCollection bindings code, the HTMLCollection tests is ~30%
slower. This will be addressed in the near future.

* Bindings/childNodes-traversal.html: Added.
* Bindings/children-traversal.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188492 268f45cc-cd09-0410-ab3c-d52691b4dbfc

PerformanceTests/Bindings/childNodes-traversal.html [new file with mode: 0644]
PerformanceTests/Bindings/children-traversal.html [new file with mode: 0644]
PerformanceTests/ChangeLog

diff --git a/PerformanceTests/Bindings/childNodes-traversal.html b/PerformanceTests/Bindings/childNodes-traversal.html
new file mode 100644 (file)
index 0000000..d938b2e
--- /dev/null
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div id="testDiv">
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+</div>
+<script src="../resources/runner.js"></script>
+<script>
+var testDiv = document.getElementById("testDiv");
+PerfTestRunner.measureRunsPerSecond({
+    description: "This benchmark covers 'Element.childNodes'.",
+    run: function() {
+        for (var i = 0; i < 100; i++) {
+            var nodes = testDiv.childNodes;
+            for (var j = 0; j < nodes.length; j++)
+                nodes[j];
+        }
+    }
+});
+</script>
+</body>
+</html>
diff --git a/PerformanceTests/Bindings/children-traversal.html b/PerformanceTests/Bindings/children-traversal.html
new file mode 100644 (file)
index 0000000..b4a12e2
--- /dev/null
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div id="testDiv">
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+  <p></p>
+  <p class="test"></p>
+</div>
+<script src="../resources/runner.js"></script>
+<script>
+var testDiv = document.getElementById("testDiv");
+PerfTestRunner.measureRunsPerSecond({
+    description: "This benchmark covers 'Element.children'.",
+    run: function() {
+        for (var i = 0; i < 100; i++) {
+            var elements = testDiv.children;
+            for (var j = 0; j < elements.length; j++)
+                elements[j];
+        }
+    }
+});
+</script>
+</body>
+</html>
index b854a94..8238ca4 100644 (file)
@@ -1,3 +1,18 @@
+2015-08-14  Chris Dumez  <cdumez@apple.com>
+
+        Add performance tests for NodeList and HTMLCollection traversal
+        https://bugs.webkit.org/show_bug.cgi?id=148043
+
+        Reviewed by Gavin Barraclough.
+
+        Add performance tests for NodeList and HTMLCollection traversal.
+        Ideally, those 2 tests should be as fast. However, due to inefficiencies
+        in our HTMLCollection bindings code, the HTMLCollection tests is ~30%
+        slower. This will be addressed in the near future.
+
+        * Bindings/childNodes-traversal.html: Added.
+        * Bindings/children-traversal.html: Added.
+
 2015-08-05  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Add a second font-fallback performance test