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>
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<script src="../resources/runner.js"></script>
|
||||
<script src="resources/image_decoder_runner.js"></script>
|
||||
<script>
|
||||
runImageDecoderPerfTests("resources/droids.gif", "Measures performance of gif decoding.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<script src="../resources/runner.js"></script>
|
||||
<script src="resources/image_decoder_runner.js"></script>
|
||||
<script>
|
||||
runImageDecoderPerfTests("resources/droids-h1v1.jpg", "Measures performance of jpeg decoding for images that do not use chroma downsampling.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<script src="../resources/runner.js"></script>
|
||||
<script src="resources/image_decoder_runner.js"></script>
|
||||
<script>
|
||||
runImageDecoderPerfTests("resources/droids-h1v2.jpg", "Measures performance of jpeg decoding for images using h1v2 chroma downsampling.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<script src="../resources/runner.js"></script>
|
||||
<script src="resources/image_decoder_runner.js"></script>
|
||||
<script>
|
||||
runImageDecoderPerfTests("resources/droids-h2v1.jpg", "Measures performance of jpeg decoding for images using h2v1 chroma downsampling.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<script src="../resources/runner.js"></script>
|
||||
<script src="resources/image_decoder_runner.js"></script>
|
||||
<script>
|
||||
runImageDecoderPerfTests("resources/droids-h2v2.jpg", "Measures performance of jpeg decoding for images using h2v2 chroma downsampling.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<script src="../resources/runner.js"></script>
|
||||
<script src="resources/image_decoder_runner.js"></script>
|
||||
<script>
|
||||
runImageDecoderPerfTests("resources/droids.loss-less.webp", "Measures performance of lossless webp decoding.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<script src="../resources/runner.js"></script>
|
||||
<script src="resources/image_decoder_runner.js"></script>
|
||||
<script>
|
||||
runImageDecoderPerfTests("resources/droids.webp", "Measures performance of lossy webp decoding.",
|
||||
true /* measure timing of potential YUV decode as well */);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<script src="../resources/runner.js"></script>
|
||||
<script src="resources/image_decoder_runner.js"></script>
|
||||
<script>
|
||||
/* Test case for decoding a typical PNG file with an RGB indexed colour palette.
|
||||
The file is a deriviative of the original resources/droids.png. */
|
||||
runImageDecoderPerfTests("resources/droids.palette.png", "Measures performance of png decoding.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<script src="../resources/runner.js"></script>
|
||||
<script src="resources/image_decoder_runner.js"></script>
|
||||
<script>
|
||||
/*
|
||||
Test case for decoding a typical PNG file with an indexed RGBA colour palette.
|
||||
The original image is in the public domain:
|
||||
https://commons.wikimedia.org/wiki/File:ZebraHighRes.png
|
||||
*/
|
||||
runImageDecoderPerfTests("resources/palette.png", "Measures performance of palettized png decoding.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<script src="../resources/runner.js"></script>
|
||||
<script src="resources/image_decoder_runner.js"></script>
|
||||
<script>
|
||||
runImageDecoderPerfTests("resources/droids.png", "Measures performance of png decoding.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
After Width: | Height: | Size: 882 KiB |
After Width: | Height: | Size: 800 KiB |
After Width: | Height: | Size: 792 KiB |
After Width: | Height: | Size: 726 KiB |
After Width: | Height: | Size: 3 MiB |
After Width: | Height: | Size: 3.5 MiB |
After Width: | Height: | Size: 2.2 MiB |
After Width: | Height: | Size: 4.4 MiB |
After Width: | Height: | Size: 64 KiB |
|
@ -0,0 +1,57 @@
|
|||
function runImageDecoderPerfTests(imageFile, testDescription,
|
||||
alsoMeasureYUVDecoding = false) {
|
||||
var isDone = false;
|
||||
|
||||
function runTest() {
|
||||
var image = new Image();
|
||||
|
||||
// NB: Because it is part of the Image.Decode() specification to wait for
|
||||
// all data to be received before attempting a decode (including for frames
|
||||
// of an animated image), we must remember this metric is only for a single
|
||||
// ImageDecoder::Decode call (as opposed to progressive decoding).
|
||||
//
|
||||
// Therefore, we avoid disc read overhead and put timing as part of
|
||||
// the onload callback.
|
||||
image.onload = function() {
|
||||
PerfTestRunner.addRunTestStartMarker();
|
||||
var startTime = PerfTestRunner.now();
|
||||
|
||||
// Issue a decode command
|
||||
image.decode().then(function () {
|
||||
var runTime = PerfTestRunner.now() - startTime;
|
||||
PerfTestRunner.measureValueAsync(runTime);
|
||||
PerfTestRunner.addRunTestEndMarker();
|
||||
|
||||
// addRunTestEndMarker sets isDone to true once all iterations are
|
||||
// performed.
|
||||
if (!isDone) {
|
||||
// To avoid cache exhasution, ensure each run lasts at least 100ms,
|
||||
// giving our image cache (which can hold on average 6 of the images
|
||||
// used in this test) time to evict them.
|
||||
var minRunTime = 100.0;
|
||||
setTimeout(runTest, Math.max(0, minRunTime - runTime));
|
||||
}
|
||||
}).catch(error => console.log(error.message));
|
||||
}
|
||||
|
||||
// Begin fetching the data
|
||||
image.src = imageFile + "?" + Math.random();
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
PerfTestRunner.startMeasureValuesAsync({
|
||||
unit: "ms",
|
||||
done: function () {
|
||||
isDone = true;
|
||||
},
|
||||
run: function () {
|
||||
runTest();
|
||||
},
|
||||
iterationCount: 20,
|
||||
description: testDescription,
|
||||
tracingCategories: 'blink',
|
||||
traceEventsToMeasure: ['ImageFrameGenerator::decode'].concat(alsoMeasureYUVDecoding ?
|
||||
['ImageFrameGenerator::decodeToYUV'] : []),
|
||||
});
|
||||
};
|
||||
}
|
After Width: | Height: | Size: 852 KiB |