Commit 594318e1 authored by Mason Freed's avatar Mason Freed Committed by Commit Bot

Clean up custom element default style perf tests

These tests were in a group that was timing out on android servers.
I converted both of them from PerfTestRunner.measureTime to
PerfTestRunner.measureRunsPerSecond(), which should be more predictable
across platforms. I also cleaned up the code a bit.

* blink_perf.dom/custom-element-default-style-with-shadow.html
* blink_perf.dom/custom-element-default-style.html

Metrics for these two tests *will* change after this CL lands,
but that should not be a concern.

Bug: 1142315
Change-Id: I80bc469553621420eb2e3f8b250d96260e8515b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2505744
Auto-Submit: Mason Freed <masonfreed@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822062}
parent d69c427c
...@@ -12,23 +12,17 @@ customElements.define('my-element', class MyElement extends HTMLElement { ...@@ -12,23 +12,17 @@ customElements.define('my-element', class MyElement extends HTMLElement {
} }
}); });
PerfTestRunner.measureTime({ PerfTestRunner.measureRunsPerSecond({
description: "Measures performance of styling custom elements with shadowRoot's innerHTML.", description: "Measures performance of styling custom elements with shadowRoot's innerHTML.",
setup: function() {
while (holderElement.innerHTML = '') {
holderElement.removeChild(holderElement.firstChild);
}
},
run: function() { run: function() {
holderElement.textContent = '';
for (i = 0; i < 100; i++) { for (i = 0; i < 100; i++) {
holderElement.appendChild(document.createElement('my-element')); holderElement.appendChild(document.createElement('my-element'));
// force layout. // force layout.
document.body.offsetWidth; document.body.offsetWidth;
} }
}, },
warmUpCount: 3, warmUpCount: 1,
iterationCount: 500,
}); });
</script> </script>
...@@ -13,23 +13,18 @@ window.customElements.define("element-constructed", class extends HTMLElement { ...@@ -13,23 +13,18 @@ window.customElements.define("element-constructed", class extends HTMLElement {
} }
}, { style: constructedStyleSheet }); }, { style: constructedStyleSheet });
PerfTestRunner.measureTime({ PerfTestRunner.measureRunsPerSecond({
description: "Measures performance of styling custom elements with default style.", description: "Measures performance of styling custom elements with default style.",
setup: function() {
while (holderElement.innerHTML = '') {
holderElement.removeChild(holderElement.firstChild);
}
},
run: function() { run: function() {
holderElement.textContent = '';
for (i = 0; i < 100; i++) { for (i = 0; i < 100; i++) {
holderElement.appendChild(document.createElement('element-constructed')); holderElement.appendChild(document.createElement('element-constructed'));
// force layout. // force layout.
document.body.offsetWidth; document.body.offsetWidth;
} }
}, },
warmUpCount: 3,
iterationCount: 500, warmUpCount: 1,
}); });
</script> </script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment