From 7aaeb067b86286dd8406f52c78ce6d809d99a310 Mon Sep 17 00:00:00 2001 From: Aaron Leventhal <aleventhal@google.com> Date: Mon, 4 Jul 2022 16:43:00 +0000 Subject: [PATCH] Workaround for Blink A11y perf test timeouts creating misleading results Cut the amount of work performed in each perf test. Once this lands, every Blink a11y performance measurement will appear to show an approximate improvement of 67% (2/3). This should fix the issue where performance regressions led to test timeouts, which in turn led to the appearance of a perf improvement, or where fixing a perf bug made gave the appearance of a perf regression. Bug: 1340360 Change-Id: I9dd1946e6c8a17adb81c404ff34c9ff58063533c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3735149 Reviewed-by: Mark Schillaci <mschillaci@google.com> Reviewed-by: Christian Biesinger <cbiesinger@chromium.org> Auto-Submit: Aaron Leventhal <aleventhal@chromium.org> Commit-Queue: Christian Biesinger <cbiesinger@chromium.org> Cr-Commit-Position: refs/heads/main@{#1020612} --- third_party/blink/perf_tests/accessibility/build-table.html | 4 ++-- third_party/blink/perf_tests/accessibility/focus-links.html | 2 +- .../insert-block-child-after-many-inline-children.html | 4 ++-- third_party/blink/perf_tests/accessibility/line-breaks.html | 2 +- .../many-nodes-toggle-content-visibility-auto.html | 2 +- .../many-nodes-toggle-content-visibility-hidden.html | 2 +- .../many-nodes-toggle-display-none-in-focusable.html | 2 +- .../accessibility/many-nodes-toggle-display-none.html | 2 +- .../accessibility/many-text-changes-deep-block-subtree.html | 2 +- .../many-text-changes-deep-hidden-subtree.html | 2 +- .../many-text-changes-deep-inline-subtree.html | 2 +- .../accessibility/many-text-changes-small-wait-between.html | 2 +- .../blink/perf_tests/accessibility/slot-updates.html | 6 +++--- .../accessibility/text-changes-ignored-in-focusable.html | 2 +- .../accessibility/text-changes-unignored-in-focusable.html | 2 +- .../blink/perf_tests/accessibility/textarea-append.html | 2 +- .../accessibility/unassignable-slots-deep-tree.html | 2 +- .../unassignable-slots-focusable-containers.html | 2 +- .../accessibility/unassignable-slots-wide-tree.html | 2 +- 19 files changed, 23 insertions(+), 23 deletions(-) diff --git a/third_party/blink/perf_tests/accessibility/build-table.html b/third_party/blink/perf_tests/accessibility/build-table.html index ee8ab5fbb0e03..8a62a28a7ba6d 100644 --- a/third_party/blink/perf_tests/accessibility/build-table.html +++ b/third_party/blink/perf_tests/accessibility/build-table.html @@ -29,11 +29,11 @@ function runTest() { } setTimeout(() => { - // Add 100 cells to each row. + // Add 33 cells to each row. for (let row = table.firstElementChild; row; row = row.nextElementSibling) { - for (let i = 0; i < 100; i++) { + for (let i = 0; i < 33; i++) { let cell = document.createElement('td'); cell.innerHTML = i; row.appendChild(cell); diff --git a/third_party/blink/perf_tests/accessibility/focus-links.html b/third_party/blink/perf_tests/accessibility/focus-links.html index 9d95939418d38..7b429e00ce6b6 100644 --- a/third_party/blink/perf_tests/accessibility/focus-links.html +++ b/third_party/blink/perf_tests/accessibility/focus-links.html @@ -47,7 +47,7 @@ function runTest() { // Iterate over some of the links and focus each one with a different // delay. Just focusing a link shouldn't incur a large cost, // even if the page has a lot of elements. - for (let i = 0; i < 100; i++) { + for (let i = 0; i < 33; i++) { window.setTimeout(() => { document.getElementById('link' + i).focus(); }, 10 * i); diff --git a/third_party/blink/perf_tests/accessibility/insert-block-child-after-many-inline-children.html b/third_party/blink/perf_tests/accessibility/insert-block-child-after-many-inline-children.html index 80c09244e953a..4fa296c82efd2 100644 --- a/third_party/blink/perf_tests/accessibility/insert-block-child-after-many-inline-children.html +++ b/third_party/blink/perf_tests/accessibility/insert-block-child-after-many-inline-children.html @@ -48,7 +48,7 @@ function runTest() { function insertDivChildAfterManySpanChildren() { testColor(getComputedStyle(container).color, red, 'Initial color'); - for (let i = 0; i < 2500; ++i) + for (let i = 0; i < 833; ++i) container.appendChild(document.createElement("span")); container.appendChild(document.createElement("div")); container.classList.add('a'); @@ -76,4 +76,4 @@ PerfTestRunner.startMeasureValuesAsync({ </script> -</html> \ No newline at end of file +</html> diff --git a/third_party/blink/perf_tests/accessibility/line-breaks.html b/third_party/blink/perf_tests/accessibility/line-breaks.html index f8d3adf96da16..c2e7564d70ed4 100644 --- a/third_party/blink/perf_tests/accessibility/line-breaks.html +++ b/third_party/blink/perf_tests/accessibility/line-breaks.html @@ -26,7 +26,7 @@ function runTest() { // in-between. var testElement = document.getElementById('testElement'); var html = ''; - for (var i = 0; i < 1000; i++) { + for (var i = 0; i < 333; i++) { html += randomString() + ' ' + randomString() + '<br>'; } testElement.innerHTML = html; diff --git a/third_party/blink/perf_tests/accessibility/many-nodes-toggle-content-visibility-auto.html b/third_party/blink/perf_tests/accessibility/many-nodes-toggle-content-visibility-auto.html index 4e83ffd177f86..a6b1fc375752d 100644 --- a/third_party/blink/perf_tests/accessibility/many-nodes-toggle-content-visibility-auto.html +++ b/third_party/blink/perf_tests/accessibility/many-nodes-toggle-content-visibility-auto.html @@ -71,7 +71,7 @@ function generateAllContent() { root2.id = 'root2'; root2.className = 'root'; - for (let i = 0; i < 50; i++) { + for (let i = 0; i < 17; i++) { const child1 = generateNodes(100, "blue"); root1.appendChild(child1); const child2 = generateNodes(100, "green"); diff --git a/third_party/blink/perf_tests/accessibility/many-nodes-toggle-content-visibility-hidden.html b/third_party/blink/perf_tests/accessibility/many-nodes-toggle-content-visibility-hidden.html index 0bd078f1be481..c3765d049754d 100644 --- a/third_party/blink/perf_tests/accessibility/many-nodes-toggle-content-visibility-hidden.html +++ b/third_party/blink/perf_tests/accessibility/many-nodes-toggle-content-visibility-hidden.html @@ -61,7 +61,7 @@ function generateAllContent() { root2.id = 'root2'; root2.className = 'root'; - for (let i = 0; i < 50; i++) { + for (let i = 0; i < 17; i++) { const child1 = generateNodes(100, "blue"); root1.appendChild(child1); const child2 = generateNodes(100, "green"); diff --git a/third_party/blink/perf_tests/accessibility/many-nodes-toggle-display-none-in-focusable.html b/third_party/blink/perf_tests/accessibility/many-nodes-toggle-display-none-in-focusable.html index 9a14e7aa83fe4..9275ca991b2e7 100644 --- a/third_party/blink/perf_tests/accessibility/many-nodes-toggle-display-none-in-focusable.html +++ b/third_party/blink/perf_tests/accessibility/many-nodes-toggle-display-none-in-focusable.html @@ -63,7 +63,7 @@ function generateAllContent() { root2.id = 'root2'; root2.className = 'root'; - for (let i = 0; i < 900; i++) { + for (let i = 0; i < 300; i++) { const child1 = generateNodes(12, "blue"); root1.appendChild(child1); const child2 = generateNodes(12, "green"); diff --git a/third_party/blink/perf_tests/accessibility/many-nodes-toggle-display-none.html b/third_party/blink/perf_tests/accessibility/many-nodes-toggle-display-none.html index a2103ad586a90..c56a641975c51 100644 --- a/third_party/blink/perf_tests/accessibility/many-nodes-toggle-display-none.html +++ b/third_party/blink/perf_tests/accessibility/many-nodes-toggle-display-none.html @@ -61,7 +61,7 @@ function generateAllContent() { root2.id = 'root2'; root2.className = 'root'; - for (let i = 0; i < 900; i++) { + for (let i = 0; i < 300; i++) { const child1 = generateNodes(12, "blue"); root1.appendChild(child1); const child2 = generateNodes(12, "green"); diff --git a/third_party/blink/perf_tests/accessibility/many-text-changes-deep-block-subtree.html b/third_party/blink/perf_tests/accessibility/many-text-changes-deep-block-subtree.html index 1543158d8d10c..e0f93e2bf15fa 100644 --- a/third_party/blink/perf_tests/accessibility/many-text-changes-deep-block-subtree.html +++ b/third_party/blink/perf_tests/accessibility/many-text-changes-deep-block-subtree.html @@ -24,7 +24,7 @@ function runTest() { startTime = PerfTestRunner.now(); document.body.innerHTML = ''; - appendManyElements(document.body, 7); + appendManyElements(document.body, 6); setTimeout(changeLeafText, 10); diff --git a/third_party/blink/perf_tests/accessibility/many-text-changes-deep-hidden-subtree.html b/third_party/blink/perf_tests/accessibility/many-text-changes-deep-hidden-subtree.html index 403252bb5d15e..e249356351e59 100644 --- a/third_party/blink/perf_tests/accessibility/many-text-changes-deep-hidden-subtree.html +++ b/third_party/blink/perf_tests/accessibility/many-text-changes-deep-hidden-subtree.html @@ -24,7 +24,7 @@ function runTest() { startTime = PerfTestRunner.now(); document.body.innerHTML = ''; - appendManyElements(document.body, 7); + appendManyElements(document.body, 6); setTimeout(changeLeafText, 10); diff --git a/third_party/blink/perf_tests/accessibility/many-text-changes-deep-inline-subtree.html b/third_party/blink/perf_tests/accessibility/many-text-changes-deep-inline-subtree.html index 8c4b7902655c3..116f23b8d7bb2 100644 --- a/third_party/blink/perf_tests/accessibility/many-text-changes-deep-inline-subtree.html +++ b/third_party/blink/perf_tests/accessibility/many-text-changes-deep-inline-subtree.html @@ -24,7 +24,7 @@ function runTest() { startTime = PerfTestRunner.now(); document.body.innerHTML = ''; - appendManyElements(document.body, 7); + appendManyElements(document.body, 6); setTimeout(changeLeafText, 10); diff --git a/third_party/blink/perf_tests/accessibility/many-text-changes-small-wait-between.html b/third_party/blink/perf_tests/accessibility/many-text-changes-small-wait-between.html index bdaed4c65d9c2..5aa235a458f41 100644 --- a/third_party/blink/perf_tests/accessibility/many-text-changes-small-wait-between.html +++ b/third_party/blink/perf_tests/accessibility/many-text-changes-small-wait-between.html @@ -24,7 +24,7 @@ function runTest() { startTime = PerfTestRunner.now(); document.body.innerHTML = ''; - appendManyElements(document.body, 7); // Create tree 7 levels deep. + appendManyElements(document.body, 6); // Create tree 6 levels deep. setTimeout(changeLeafText, 10); diff --git a/third_party/blink/perf_tests/accessibility/slot-updates.html b/third_party/blink/perf_tests/accessibility/slot-updates.html index a5f040c57aae8..3322ee4bd4a6f 100644 --- a/third_party/blink/perf_tests/accessibility/slot-updates.html +++ b/third_party/blink/perf_tests/accessibility/slot-updates.html @@ -7,9 +7,9 @@ <sn-form slot="form-slot"></sn-form> </sn-show-element> <script> - const TABLE_COLS = 15; - const TABLE_ROWS = 15; - const FORM_CONTROLS = 15; + const TABLE_COLS = 5; + const TABLE_ROWS = 5; + const FORM_CONTROLS = 5; class snShowElement extends HTMLElement { constructor() { diff --git a/third_party/blink/perf_tests/accessibility/text-changes-ignored-in-focusable.html b/third_party/blink/perf_tests/accessibility/text-changes-ignored-in-focusable.html index adfc3cc256e4d..83e7b77c4b3f5 100644 --- a/third_party/blink/perf_tests/accessibility/text-changes-ignored-in-focusable.html +++ b/third_party/blink/perf_tests/accessibility/text-changes-ignored-in-focusable.html @@ -27,7 +27,7 @@ function runTest() { startTime = PerfTestRunner.now(); document.body.innerHTML = ''; - appendManyElements(document.body, 7); + appendManyElements(document.body, 6); setTimeout(changeLeafText, 250); diff --git a/third_party/blink/perf_tests/accessibility/text-changes-unignored-in-focusable.html b/third_party/blink/perf_tests/accessibility/text-changes-unignored-in-focusable.html index ce51f8b00534f..bfc7318863e03 100644 --- a/third_party/blink/perf_tests/accessibility/text-changes-unignored-in-focusable.html +++ b/third_party/blink/perf_tests/accessibility/text-changes-unignored-in-focusable.html @@ -24,7 +24,7 @@ function runTest() { startTime = PerfTestRunner.now(); document.body.innerHTML = ''; - appendManyElements(document.body, 7); + appendManyElements(document.body, 6); setTimeout(changeLeafText, 250); diff --git a/third_party/blink/perf_tests/accessibility/textarea-append.html b/third_party/blink/perf_tests/accessibility/textarea-append.html index c6b29f77ed19c..eef60386bca0c 100644 --- a/third_party/blink/perf_tests/accessibility/textarea-append.html +++ b/third_party/blink/perf_tests/accessibility/textarea-append.html @@ -20,7 +20,7 @@ function runTest() { // Fill the textarea with 1000 lines of random numbers. var testElement = document.getElementById('testElement'); - testElement.textContent = new Array(1000).fill(0).map( + testElement.textContent = new Array(333).fill(0).map( (_, i) => Math.floor(100*Math.random())).join('\n'); // Wait to allow the asynchronous accessibility code that's diff --git a/third_party/blink/perf_tests/accessibility/unassignable-slots-deep-tree.html b/third_party/blink/perf_tests/accessibility/unassignable-slots-deep-tree.html index 5825f23de81d4..00154c7684293 100644 --- a/third_party/blink/perf_tests/accessibility/unassignable-slots-deep-tree.html +++ b/third_party/blink/perf_tests/accessibility/unassignable-slots-deep-tree.html @@ -61,7 +61,7 @@ function generateAllContent() { root2.id = 'root2'; root2.className = 'root'; - for (let i = 0; i < 300; i++) { + for (let i = 0; i < 100; i++) { const child1 = generateNodes(20, "blue"); root1.appendChild(child1); const child2 = generateNodes(20, "green"); diff --git a/third_party/blink/perf_tests/accessibility/unassignable-slots-focusable-containers.html b/third_party/blink/perf_tests/accessibility/unassignable-slots-focusable-containers.html index 925e13adf2ddb..fa621caac900e 100644 --- a/third_party/blink/perf_tests/accessibility/unassignable-slots-focusable-containers.html +++ b/third_party/blink/perf_tests/accessibility/unassignable-slots-focusable-containers.html @@ -63,7 +63,7 @@ function generateAllContent() { root2.id = 'root2'; root2.className = 'root'; - for (let i = 0; i < 300; i++) { + for (let i = 0; i < 100; i++) { const child1 = generateNodes(20, "blue"); root1.appendChild(child1); const child2 = generateNodes(20, "green"); diff --git a/third_party/blink/perf_tests/accessibility/unassignable-slots-wide-tree.html b/third_party/blink/perf_tests/accessibility/unassignable-slots-wide-tree.html index cc758b3088819..ad285f3c2c6f0 100644 --- a/third_party/blink/perf_tests/accessibility/unassignable-slots-wide-tree.html +++ b/third_party/blink/perf_tests/accessibility/unassignable-slots-wide-tree.html @@ -61,7 +61,7 @@ function generateAllContent() { root2.id = 'root2'; root2.className = 'root'; - for (let i = 0; i < 30; i++) { + for (let i = 0; i < 10; i++) { const child1 = generateNodes(5, "blue"); root1.appendChild(child1); const child2 = generateNodes(5, "green");