Skip to content

Commit

Permalink
Add perf-test for many paint layers.
Browse files Browse the repository at this point in the history
Now that we've removed UpdateLayerPositionsAfterLayout, add a perf
test so that nobody in the future adds code which iterates over all
the paint layers (or similar) after each layout.

Bug: 504567
Change-Id: Ie379f5e4ec0228ac8318e9e589fdcfaf0dc88e21
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4994412
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Auto-Submit: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1217915}
  • Loading branch information
bfgeek authored and Chromium LUCI CQ committed Oct 31, 2023
1 parent aca20b4 commit 1f286ad
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions third_party/blink/perf_tests/layout/layer-overhead.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<title>Tests the overhead of many paint layers - don't add code which iterates over every paint layer upon each layout!</title>
<style>
#container {
position: relative;
width: 100px;
height: 200px;
overflow: hidden;
}
#container > div {
overflow: hidden;
}
#target {
position: relative;
width: 100px;
height: 100px;
overflow: hidden;
top: 0px;
}
</style>
<script src="../resources/runner.js"></script>
<body>
<pre id="log"></pre>
<div id="container"></div>
<div id="target"></div>
<script>
let container = document.getElementById('container');
for (let i = 0; i < 50000; i++) {
container.appendChild(document.createElement('div'));
}
PerfTestRunner.measureRunsPerSecond({
description: 'Measures performance of many paint layers existing in the DOM',
run: () => {
let target = document.getElementById('target');
target.style.top = '10px';
PerfTestRunner.forceLayout();
target.style.top = '0px';
PerfTestRunner.forceLayout();
},
});
</script>
</body>

0 comments on commit 1f286ad

Please sign in to comment.