mirror of
https://github.com/servo/servo.git
synced 2025-09-10 15:08:21 +01:00
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>
This commit is contained in:
parent
7621332824
commit
ee781b71b4
648 changed files with 359694 additions and 0 deletions
1
tests/blink_perf_tests/perf_tests/loading/OWNERS
Normal file
1
tests/blink_perf_tests/perf_tests/loading/OWNERS
Normal file
|
@ -0,0 +1 @@
|
|||
file://third_party/blink/renderer/platform/loader/OWNERS
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
</head>
|
||||
<body>
|
||||
<script src="../resources/runner.js"></script>
|
||||
<script>
|
||||
|
||||
let isDone = false;
|
||||
|
||||
PerfTestRunner.startMeasureValuesAsync({
|
||||
description: "Measures the time to fetch 1,000 resources in batches of 100 from the disk cache.",
|
||||
unit: "ms",
|
||||
run: async function() {
|
||||
while (!isDone) {
|
||||
PerfTestRunner.addRunTestStartMarker();
|
||||
let startTime = PerfTestRunner.now();
|
||||
let fetches = [];
|
||||
let count = 0;
|
||||
// Send 10 batches of 100 fetches each to prevent resource errors.
|
||||
// The net stack will error fetches if too many (~300) are in-flight at a time.
|
||||
for (let runs = 0; runs < 10; runs++) {
|
||||
for (i = 0; i < 100; i++) {
|
||||
count++;
|
||||
fetches.push(fetch("resources/blank.js?" + count));
|
||||
}
|
||||
await Promise.all(fetches)
|
||||
}
|
||||
PerfTestRunner.measureValueAsync(PerfTestRunner.now() - startTime);
|
||||
PerfTestRunner.addRunTestEndMarker();
|
||||
}
|
||||
},
|
||||
done: () => {isDone = true;},
|
||||
iterationCount: 7,
|
||||
warmUpCount: 2,
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
</head>
|
||||
<body>
|
||||
<script src="../resources/runner.js"></script>
|
||||
<script>
|
||||
|
||||
let isDone = false;
|
||||
|
||||
PerfTestRunner.startMeasureValuesAsync({
|
||||
description: "Measures the time to fetch 1,000 resources in batches of 100, bypassing the cache.",
|
||||
unit: "ms",
|
||||
run: async function() {
|
||||
while (!isDone) {
|
||||
PerfTestRunner.addRunTestStartMarker();
|
||||
let startTime = PerfTestRunner.now();
|
||||
let fetches = [];
|
||||
let count = 0;
|
||||
// Send 10 batches of 100 fetches each to prevent resource errors.
|
||||
// The net stack will error fetches if too many (~300) are in-flight at a time.
|
||||
for (let runs = 0; runs < 10; runs++) {
|
||||
for (i = 0; i < 100; i++) {
|
||||
count++;
|
||||
fetches.push(fetch("resources/blank.js?" + count, {cache: "no-store"}));
|
||||
}
|
||||
await Promise.all(fetches)
|
||||
}
|
||||
PerfTestRunner.measureValueAsync(PerfTestRunner.now() - startTime);
|
||||
PerfTestRunner.addRunTestEndMarker();
|
||||
}
|
||||
},
|
||||
done: () => {isDone = true;},
|
||||
iterationCount: 7,
|
||||
warmUpCount: 2,
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
let run = 0;
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const runParam = urlParams.get('run');
|
||||
if (runParam) {
|
||||
run = runParam;
|
||||
}
|
||||
const nonce = crypto.randomUUID();
|
||||
let index = run * 100000;
|
||||
let inject = "";
|
||||
for (let i = 0; i < 10000; i++) {
|
||||
index++;
|
||||
inject += '<script src="blank.js?n=' + nonce + '&i=' + index + '"></sc' + 'ript>';
|
||||
}
|
||||
document.write(inject);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
10008
tests/blink_perf_tests/perf_tests/loading/resources/10k-scripts.html
Normal file
10008
tests/blink_perf_tests/perf_tests/loading/resources/10k-scripts.html
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1 @@
|
|||
/* */
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
Test loading of a page and waiting for the page to load.
|
||||
PerfTestRunner.measurePageLoadTime doesn't wait for external resources
|
||||
and is geared more towards parse/layout testing.
|
||||
*/
|
||||
function runPageLoadPerfTest(htmlFile, testDescription) {
|
||||
let isDone = false;
|
||||
let count = 0;
|
||||
|
||||
function runTest() {
|
||||
PerfTestRunner.addRunTestStartMarker();
|
||||
let startTime = PerfTestRunner.now();
|
||||
count++;
|
||||
let testFrame = document.createElement('iframe');
|
||||
testFrame.src = htmlFile + "?run=" + count;
|
||||
testFrame.width = "10";
|
||||
testFrame.height = "10";
|
||||
document.querySelector('body').appendChild(testFrame);
|
||||
|
||||
testFrame.onload = function() {
|
||||
let runTime = PerfTestRunner.now() - startTime;
|
||||
PerfTestRunner.measureValueAsync(runTime);
|
||||
PerfTestRunner.addRunTestEndMarker();
|
||||
|
||||
if (!isDone) {
|
||||
testFrame.remove();
|
||||
var minRunTime = 100.0;
|
||||
setTimeout(runTest, Math.max(0, minRunTime - runTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
PerfTestRunner.startMeasureValuesAsync({
|
||||
unit: "ms",
|
||||
done: function () {
|
||||
isDone = true;
|
||||
},
|
||||
run: function () {
|
||||
runTest();
|
||||
},
|
||||
iterationCount: 7,
|
||||
warmUpCount: 2,
|
||||
description: testDescription
|
||||
});
|
||||
};
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
</head>
|
||||
<body>
|
||||
<script src="../resources/runner.js"></script>
|
||||
<script src="resources/page_load_runner.js"></script>
|
||||
<script>
|
||||
runPageLoadPerfTest("resources/10k-scripts.html", "Measures performance of loading a page with 10,000 external scripts from the memory cache.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
</head>
|
||||
<body>
|
||||
<script src="../resources/runner.js"></script>
|
||||
<script src="resources/page_load_runner.js"></script>
|
||||
<script>
|
||||
runPageLoadPerfTest("resources/10k-scripts-nocache.html", "Measures performance of loading a page with 10,000 external scripts, bypassing the cache.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue