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>
52 lines
1.6 KiB
HTML
Vendored
52 lines
1.6 KiB
HTML
Vendored
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>
|
|
Test performance of AudioParamTimeline::InsertEvent.
|
|
</title>
|
|
<script src="../resources/runner.js"></script>
|
|
</head>
|
|
<body>
|
|
<script>
|
|
// Number of events to insert.
|
|
let numberOfEvents = 10000;
|
|
let sampleRate = 44100;
|
|
let gainNode = null;
|
|
let timeInterval = .03;
|
|
let initialValue = 1;
|
|
let startingValueDelta = initialValue / numberOfEvents;
|
|
|
|
// Convert time (in seconds) to sample frames.
|
|
function timeToSampleFrame(time, sampleRate) {
|
|
return Math.floor(0.5 + time * sampleRate);
|
|
}
|
|
|
|
function renderLength(numberOfEvents) {
|
|
return timeToSampleFrame((numberOfEvents + 1) * timeInterval, sampleRate);
|
|
}
|
|
|
|
PerfTestRunner.measureTime({
|
|
description: "Measures performance of 10k InsertEvents using calls to setValueAtTime.",
|
|
|
|
setup: function () {
|
|
let context =
|
|
new OfflineAudioContext(2, renderLength(numberOfEvents), sampleRate);
|
|
gainNode = context.createGain();
|
|
},
|
|
|
|
run: function() {
|
|
let value = initialValue;
|
|
for (let k = 0; k < numberOfEvents; ++k) {
|
|
let startTime = k * timeInterval;
|
|
gainNode.gain.setValueAtTime(value, startTime);
|
|
value -= startingValueDelta;
|
|
}
|
|
},
|
|
iterationCount: 5,
|
|
warmUpCount: 2,
|
|
tracingCategories: 'disabled-by-default-webaudio.audionode',
|
|
traceEventsToMeasure: ['AudioParamTimeline::InsertEvent'],
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|