mirror of
https://github.com/servo/servo.git
synced 2025-09-10 15:08:21 +01:00
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>
49 lines
1.2 KiB
HTML
Vendored
49 lines
1.2 KiB
HTML
Vendored
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<title>
|
|
Test CPU performance of the WebGLRenderingContext.bufferSubData binding
|
|
</title>
|
|
<script src="../resources/runner.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
<canvas id="canvas" width=400 height=400></canvas>
|
|
<script>
|
|
const canvas = document.getElementById('canvas');
|
|
const gl = canvas.getContext('webgl');
|
|
|
|
const vertexBuffer = gl.createBuffer();
|
|
|
|
const data = new Float32Array([
|
|
0.0, 0.5, 0.0,
|
|
-0.5, -0.5, 0.0,
|
|
0.5, -0.5, 0.0,
|
|
]);
|
|
const dataCopy = new Float32Array([
|
|
0.0, 0.5, 0.0,
|
|
-0.5, -0.5, 0.0,
|
|
0.5, -0.5, 0.0,
|
|
]);
|
|
const sizeInBytes = data.length * data.BYTES_PER_ELEMENT;
|
|
|
|
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
|
|
// Ensure twice the size of `data`.
|
|
gl.bufferData(gl.ARRAY_BUFFER, sizeInBytes * 2, gl.STATIC_DRAW);
|
|
|
|
const iterations = 10000;
|
|
PerfTestRunner.measureInnerRAFTime({
|
|
description: `CPU time for ${iterations * 2} calls to WebGLRenderingContext.bufferSubData`,
|
|
warmUpCount: 10,
|
|
run() {
|
|
for (let i = 0; i < iterations; ++i) {
|
|
gl.bufferSubData(gl.ARRAY_BUFFER, 0, data);
|
|
gl.bufferSubData(gl.ARRAY_BUFFER, sizeInBytes, dataCopy);
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html>
|