Bug 1353900 - Add talos stylo bloom-basic test; r?jmaher draft
authorRob Wood <rwood@mozilla.com>
Thu, 06 Apr 2017 15:11:25 -0400
changeset 557426 e2b4c784414c1a89c776a0ea0f47c749162dc325
parent 556510 cbc166e6fe86a6f3fdcb346ad4f970a35aa7bf8c
child 623055 6dc3f2e7c735dcc53ef9db3fa6c4768fef48c7f7
push id52719
push userrwood@mozilla.com
push dateThu, 06 Apr 2017 20:05:56 +0000
reviewersjmaher
bugs1353900
milestone55.0a1
Bug 1353900 - Add talos stylo bloom-basic test; r?jmaher MozReview-Commit-ID: CYxto0ALXaZ
testing/talos/talos.json
testing/talos/talos/test.py
testing/talos/talos/tests/perf-reftest/bloom-basic-ref.html
testing/talos/talos/tests/perf-reftest/bloom-basic.html
testing/talos/talos/tests/perf-reftest/bloom_basic.manifest
testing/talos/talos/tests/perf-reftest/bloom_basic_ref.manifest
testing/talos/talos/tests/perf-reftest/util.js
--- a/testing/talos/talos.json
+++ b/testing/talos/talos.json
@@ -76,16 +76,22 @@
         },
         "svgr": {
             "tests": ["tsvgx", "tsvgr_opacity", "tart", "tscrollx", "cart", "tsvg_static"],
             "talos_options": ["--disable-e10s"]
         },
         "svgr-e10s": {
             "tests": ["tsvgx", "tsvgr_opacity", "tart", "tscrollx", "cart", "tsvg_static"]
         },
+        "perf-reftest": {
+            "tests": ["bloom_basic", "bloom_basic_ref"]
+        },
+        "perf-reftest-e10s": {
+            "tests": ["bloom_basic", "bloom_basic_ref"]
+        },
         "tp5o": {
             "tests": ["tp5o"],
             "pagesets_name": "tp5n.zip",
             "talos_options": ["--disable-e10s"]
         },
         "tp5o-e10s": {
             "tests": ["tp5o"],
             "pagesets_name": "tp5n.zip"
--- a/testing/talos/talos/test.py
+++ b/testing/talos/talos/test.py
@@ -723,8 +723,38 @@ class a11yr(PageloaderTest):
     """
     tpmanifest = '${talos}/tests/a11y/a11y.manifest'
     tpcycles = 1
     tppagecycles = 25
     tpmozafterpaint = True
     preferences = {'dom.send_after_paint_to_content': False}
     unit = 'ms'
     alert_threshold = 5.0
+
+
+@register_test()
+class bloom_basic(PageloaderTest):
+    """
+    Stylo bloom_basic test
+    """
+    tpmanifest = '${talos}/tests/perf-reftest/bloom_basic.manifest'
+    tpcycles = 1
+    tppagecycles = 25
+    gecko_profile_interval = 1
+    gecko_profile_entries = 2000000
+    filters = filter.ignore_first.prepare(5) + filter.median.prepare()
+    unit = 'ms'
+    lower_is_better = True
+
+
+@register_test()
+class bloom_basic_ref(PageloaderTest):
+    """
+    Stylo bloom_basic_ref test
+    """
+    tpmanifest = '${talos}/tests/perf-reftest/bloom_basic_ref.manifest'
+    tpcycles = 1
+    tppagecycles = 25
+    gecko_profile_interval = 1
+    gecko_profile_entries = 2000000
+    filters = filter.ignore_first.prepare(5) + filter.median.prepare()
+    unit = 'ms'
+    lower_is_better = True
new file mode 100644
--- /dev/null
+++ b/testing/talos/talos/tests/perf-reftest/bloom-basic-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <script src="util.js"></script>
+    <script>
+window.onload = function() {
+  document.head.appendChild(build_rule("span > div", 10000, '{ color: "blue"; } '));
+  let dom = build_dom(5000, "div");
+
+  let start = performance.now();
+  document.body.appendChild(dom);
+  window.foo = window.getComputedStyle(document.body).color;
+  let end = performance.now();
+
+  // when running in talos report results; when running outside talos just alert
+  if (window.tpRecordTime) {
+    window.tpRecordTime(end - start, start);
+  } else {
+    console.log(end);
+    console.log(start);
+    alert("Result: " + (end - start).toFixed(2) + " (ms)");
+  }
+}
+    </script>
+  </head>
+  <body>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/testing/talos/talos/tests/perf-reftest/bloom-basic.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <script src="util.js"></script>
+    <script>
+window.onload = function() {
+  document.head.appendChild(build_rule("span div", 10000, '{ color: "blue"; } '));
+  let dom = build_dom(5000, "div");
+
+  let start = performance.now();
+  document.body.appendChild(dom);
+  window.foo = window.getComputedStyle(document.body).color;
+  let end = performance.now();
+
+  // when running in talos report results; when running outside talos just alert
+  if (window.tpRecordTime) {
+    window.tpRecordTime(end - start, start);
+  } else {
+    console.log(end);
+    console.log(start);
+    alert("Result: " + (end - start).toFixed(2) + " (ms)");
+  }
+}
+    </script>
+  </head>
+  <body>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/testing/talos/talos/tests/perf-reftest/bloom_basic.manifest
@@ -0,0 +1,1 @@
+% http://localhost/tests/perf-reftest/bloom-basic.html
new file mode 100644
--- /dev/null
+++ b/testing/talos/talos/tests/perf-reftest/bloom_basic_ref.manifest
@@ -0,0 +1,1 @@
+% http://localhost/tests/perf-reftest/bloom-basic-ref.html
new file mode 100644
--- /dev/null
+++ b/testing/talos/talos/tests/perf-reftest/util.js
@@ -0,0 +1,17 @@
+function build_dom(n, elemName) {
+  var ours = document.createElement(elemName);
+  if (n != 1) {
+    var leftSize = Math.floor(n/2);
+    var rightSize = Math.floor((n-1)/2);
+    ours.appendChild(build_dom(leftSize, elemName));
+    if (rightSize > 0)
+      ours.appendChild(build_dom(rightSize, elemName));
+  }
+  return ours;
+}
+
+function build_rule(selector, selectorRepeat, declaration) {
+  var s = document.createElement("style");
+  s.textContent = Array(selectorRepeat).fill(selector).join(", ") + declaration;
+  return s;
+}