servo/tests/blink_perf_tests/perf_tests/layout/flexbox-row-stretch-height-indefinite.html
Jonathan Schwender ee781b71b4
tests: Vendor blink perf tests (#38654)
Vendors the [blink perf
tests](https://chromium.googlesource.com/chromium/src/+/HEAD/third_party/blink/perf_tests/).
These perf tests are useful to evaluate the performance of servo. 
The license that governs the perf tests is included in the folder. 
Running benchmark cases automatically is left to future work.

The update.py script is taken from mozjs and slightly adapted, so we can
easily filter
(and patch if this should be necessary in the future.

Testing: This PR just adds the perf_tests, but does not use or modify
them in any way.

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-08-17 09:54:04 +00:00

48 lines
1.3 KiB
HTML
Vendored

<!DOCTYPE html>
<html>
<head>
<script src="../resources/runner.js"></script>
<style>
* {
/* Make the text the same size in chrome and firefox. */
font-family: "Times New Roman";
font-size: 16px;
}
</style>
</head>
<body>
<div style="display: flex; width: 800px; background: orange;">
<div id="neighbor" style="width: 50px;"></div>
<!-- 750px lets the text not wrap. -->
<div id="test" style="width: 750px;"></div>
</div>
</body>
<script>
const test = document.querySelector('#test');
for (let i = 0; i < 60; i++) {
test.innerHTML += '<div style="height: 1%">some stuff here blah blah blah blah blah blah blah blah blah blah blah blah blah</div>';
}
const neighbor = document.querySelector("#neighbor");
function runTest()
{
// When #neighbor changes height, #test shouldn't have to relayout.
// 1200px is higher than #test's intrinsic block size and its pre-stretched
// layout size. Performance characteristics change if that's not the case.
neighbor.style.height = "1200px";
PerfTestRunner.forceLayout();
neighbor.style.height = "1300px";
PerfTestRunner.forceLayout();
}
PerfTestRunner.measureRunsPerSecond({
description: "Ensures cache hits for stretched flex items in a row flexbox with indefinite height, when the flexbox changes heights.",
run: runTest,
});
</script>
</html>