Bug 1838200 - Flush layout before running perf-reftest measurements. r=tnikkel,perftest-reviewers,kshampur

Otherwise we might not measure what we want, if we haven't unsuppressed
painting or flushed layout yet flushing style might be a no-op.

Differential Revision: https://phabricator.services.mozilla.com/D181363
This commit is contained in:
Emilio Cobos Álvarez 2023-06-19 17:39:51 +00:00
parent 264a268d3b
commit f9da675446
45 changed files with 46 additions and 45 deletions

View File

@ -8,7 +8,7 @@ window.onload = function() {
document.head.appendChild(build_rule("caption div, caption span", 1, "{ color: blue; } ", 20000));
let dom = build_dom(5000, "div");
flush_style();
flush_layout();
perf_start();
document.body.appendChild(dom);
flush_style(dom);

View File

@ -7,7 +7,7 @@ window.onload = function() {
document.head.appendChild(build_rule("caption div, caption span", 20000, "{ color: blue; } "));
let dom = build_dom(5000, "div");
flush_style();
flush_layout();
perf_start();
document.body.appendChild(dom);
flush_style(dom);

View File

@ -15,7 +15,7 @@ function set_class(n) {
window.onload = function() {
let root = build_dom(50000, "div");
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
perf_start();
set_class(root);
flush_style(root);

View File

@ -15,7 +15,7 @@ function set_class(n) {
window.onload = function() {
let root = build_dom(50000, "div");
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
set_class(root);
perf_start();
flush_style(root);

View File

@ -10,7 +10,7 @@ window.onload = function() {
root.className = "root";
root.appendChild(build_dom(100000, "div"));
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
perf_start();
document.body.className = "x";
flush_style(root);

View File

@ -3,6 +3,7 @@
<body>
<script>
window.onload = function() {
flush_layout();
perf_start();
let s = document.createElement("style");
s.appendChild(document.createTextNode(`* {`));

View File

@ -14,7 +14,7 @@ window.onload = function() {
let last = root.lastChild;
last.appendChild(build_dom(5000, "div"));
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
perf_start();
last.className = "x";
flush_style(root);

View File

@ -14,7 +14,7 @@ window.onload = function() {
let last = root.lastChild;
last.appendChild(build_dom(5000, "div"));
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
perf_start();
last.className = "x";
flush_style(root);

View File

@ -8,7 +8,7 @@ window.onload = function() {
let root = document.createElement("div");
root.appendChild(build_dom(100000, "div"));
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
perf_start();
root.className = "x";
flush_style(root);

View File

@ -7,7 +7,7 @@ window.onload = function() {
document.head.appendChild(build_rule("body > .foo > .foo > .foo", 1000, "{ color: blue; } "));
let dom = build_dom(5000, "div", { attributes: {"class": "foo" } });
flush_style();
flush_layout();
perf_start();
document.body.appendChild(dom);
flush_style(dom);

View File

@ -12,7 +12,7 @@ window.onload = function() {
root.appendChild(first);
root.appendChild(build_dom(64000, "div"));
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
perf_start();
first.firstChild.remove();
flush_style(root);

View File

@ -12,7 +12,7 @@ window.onload = function() {
root.appendChild(first);
root.appendChild(build_dom(64000, "div"));
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
perf_start();
root.firstChild.remove();
flush_style(root);

View File

@ -11,7 +11,7 @@ window.onload = function() {
}
div.setAttribute("y", val);
document.body.appendChild(div);
flush_style(div);
flush_layout(div);
perf_start();
div.style.color = "green";
flush_style(div);

View File

@ -8,7 +8,7 @@ window.onload = function() {
let dom = build_dom(5000, "div", { elemNameLeft: "div", elemNameRight: "div",
attributes: { style: "background-color: yellow;"} });
flush_style();
flush_layout();
perf_start();
document.body.appendChild(dom);
flush_style(dom);

View File

@ -7,7 +7,7 @@ window.onload = function() {
document.head.appendChild(build_rule("caption div", 10000, "{ color: blue; } "));
let dom = build_dom(5000, "div", { elemNameLeft: "div", elemNameRight: "div" });
flush_style();
flush_layout();
perf_start();
document.body.appendChild(dom);
flush_style(dom);

View File

@ -13,14 +13,14 @@ window.onload = function() {
let elem = document.createElement("caption");
p.appendChild(elem);
document.body.appendChild(dom);
flush_style();
flush_layout();
perf_start();
var state = true;
for (i = 0; i < 100000; ++i) {
elem.setAttribute("id", state ? "" : "foo");
state = !state;
window.getComputedStyle(elem).color;
flush_style(elem);
}
perf_finish();
};

View File

@ -8,7 +8,7 @@ window.onload = function() {
document.head.appendChild(build_rule("caption div, caption span", 1, "{ color: blue; } ", 20000));
let dom = build_dom(5000, "div");
flush_style();
flush_layout();
perf_start();
document.body.appendChild(dom);
flush_style(dom);

View File

@ -7,7 +7,7 @@ window.onload = function() {
document.head.appendChild(build_rule("caption > div, caption > span", 20000, "{ color: blue; } "));
let dom = build_dom(5000, "div");
flush_style();
flush_layout();
perf_start();
document.body.appendChild(dom);
flush_style(dom);

View File

@ -7,7 +7,7 @@ window.onload = function() {
document.head.appendChild(build_rule("caption div, caption span", 20000, "{ color: blue; } "));
let dom = build_dom(5000, "div");
flush_style();
flush_layout();
perf_start();
document.body.appendChild(dom);
flush_style(dom);

View File

@ -15,7 +15,7 @@ function set_class(n) {
window.onload = function() {
let root = build_dom(50000, "div");
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
perf_start();
set_class(root);
flush_style(root);

View File

@ -15,7 +15,7 @@ function set_class(n) {
window.onload = function() {
let root = build_dom(50000, "div");
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
set_class(root);
perf_start();
flush_style(root);

View File

@ -7,7 +7,7 @@
window.onload = function() {
let root = build_dom(50000, "div");
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
root.className = "x";
perf_start();
flush_style(root);

View File

@ -23,7 +23,7 @@ window.onload = function() {
document.body.appendChild(el);
els.push(el);
}
flush_style(els[0]);
flush_layout(els[0]);
perf_start();
for (let el of els) {
el.className = "";

View File

@ -25,7 +25,7 @@ window.onload = function() {
document.body.appendChild(el);
els.push(el);
}
flush_style(els[0]);
flush_layout(els[0]);
perf_start();
for (let el of els) {
el.className = "";

View File

@ -9,7 +9,7 @@ window.onload = function() {
let root = document.createElement("div");
root.className = "root";
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
perf_start();
document.body.className = "x";
flush_style(root);

View File

@ -10,7 +10,7 @@ window.onload = function() {
root.className = "root";
root.appendChild(build_dom(100000, "div"));
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
perf_start();
document.body.className = "x";
flush_style(root);

View File

@ -14,7 +14,7 @@ window.onload = function() {
let last = root.lastChild;
last.appendChild(build_dom(5000, "div"));
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
perf_start();
last.className = "x";
flush_style(root);

View File

@ -14,7 +14,7 @@ window.onload = function() {
let last = root.lastChild;
last.appendChild(build_dom(5000, "div"));
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
perf_start();
last.className = "x";
flush_style(root);

View File

@ -14,7 +14,7 @@ window.onload = function() {
let last = root.lastChild;
last.appendChild(build_dom(5000, "div"));
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
perf_start();
last.className = "x";
flush_style(root);

View File

@ -8,7 +8,7 @@ window.onload = function() {
let root = document.createElement("div");
root.appendChild(build_dom(100000, "div"));
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
perf_start();
root.className = "x";
flush_style(root);

View File

@ -8,7 +8,7 @@ window.onload = function() {
let root = document.createElement("div");
root.appendChild(document.createElement("div"));
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
perf_start();
root.firstChild.className = "x";
flush_style(root);

View File

@ -11,7 +11,7 @@ window.onload = function() {
first.appendChild(document.createElement("div"));
root.appendChild(first);
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
perf_start();
first.firstChild.remove();
flush_style(root);

View File

@ -12,7 +12,7 @@ window.onload = function() {
root.appendChild(first);
root.appendChild(build_dom(64000, "div"));
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
perf_start();
first.firstChild.remove();
flush_style(root);

View File

@ -11,7 +11,7 @@ window.onload = function() {
first.className = "first";
root.appendChild(first);
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
perf_start();
root.firstChild.remove();
flush_style(root);

View File

@ -12,7 +12,7 @@ window.onload = function() {
root.appendChild(first);
root.appendChild(build_dom(64000, "div"));
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
perf_start();
root.firstChild.remove();
flush_style(root);

View File

@ -18,7 +18,7 @@ window.onload = function() {
root.appendChild(build_dom(50000, "div"));
let leftmost = find_leftmost(root);
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
perf_start();
document.body.className = "x";
leftmost.className = "y";

View File

@ -19,7 +19,7 @@ window.onload = function() {
let leftmost = find_leftmost(root);
leftmost.className = "y";
document.body.appendChild(root);
flush_style(root);
flush_layout(root);
perf_start();
document.body.className = "x";
flush_style(root);

View File

@ -12,7 +12,7 @@ window.onload = function() {
roots.push(root);
document.body.appendChild(root);
}
flush_style(roots[0]);
flush_layout(roots[0]);
perf_start();
for (x in ["x", "", "x"]) {
for (let root of roots) {

View File

@ -13,7 +13,7 @@ window.onload = function() {
roots.push(root);
document.body.appendChild(root);
}
flush_style(roots[0]);
flush_layout(roots[0]);
perf_start();
for (x in ["x", "", "x"]) {
for (let root of roots) {

View File

@ -11,7 +11,7 @@ window.onload = function() {
roots.push(root);
document.body.appendChild(root);
}
flush_style(roots[0]);
flush_layout(roots[0]);
perf_start();
for (x in ["x", "", "x"]) {
for (let root of roots) {

View File

@ -4,7 +4,7 @@
window.onload = function() {
var div = document.createElement("div");
document.body.appendChild(div);
flush_style(div);
flush_layout(div);
perf_start();
div.style.color = "green";
flush_style(div);

View File

@ -11,7 +11,7 @@ window.onload = function() {
}
div.setAttribute("y", val);
document.body.appendChild(div);
flush_style(div);
flush_layout(div);
perf_start();
div.style.color = "green";
flush_style(div);

View File

@ -7,7 +7,7 @@ window.onload = function() {
document.head.appendChild(build_rule("div", 1, "{ color: blue; } "));
let dom = build_dom(2000, "div");
flush_style();
flush_layout();
perf_start();
document.body.appendChild(dom);
flush_style(dom);

View File

@ -8,7 +8,7 @@ window.onload = function() {
let dom = build_dom(5000, "div", { elemNameLeft: "div", elemNameRight: "div",
attributes: { style: "background-color: yellow;"} });
flush_style();
flush_layout();
perf_start();
document.body.appendChild(dom);
flush_style(dom);

View File

@ -7,7 +7,7 @@ window.onload = function() {
document.head.appendChild(build_rule("caption div", 10000, "{ color: blue; } "));
let dom = build_dom(5000, "div", { elemNameLeft: "div", elemNameRight: "div" });
flush_style();
flush_layout();
perf_start();
document.body.appendChild(dom);
flush_style(dom);