Bug 1624987 - Update webaudio-benchmark. r=dminor

This update is from:
579c472bb8

Differential Revision: https://phabricator.services.mozilla.com/D68394

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Paul Adenot 2020-03-27 12:23:06 +00:00
parent 367201db7c
commit 80a88fb39a
9 changed files with 42 additions and 5251 deletions

View File

@ -8,13 +8,6 @@ Just open `index.html`. Time are in milliseconds, lower is better.
Look into `benchmarks.js`, it's pretty straightforward.
## Grafana dashboard
When adding new benchmarks, run `node generate-grafana-dashboard.js`, this
should overwrite `webaudio.json` so that the new benchmarks are registered in
grafana.
## License
MPL 2.0

View File

@ -1 +0,0 @@
0.2

View File

@ -13,7 +13,7 @@ registerTestFile("think-stereo-38000.wav");
registerTestCase({
func: function () {
var oac = new OfflineAudioContext(1, 120 * samplerate, samplerate);
var oac = new OfflineAudioContext(1, DURATION * samplerate, samplerate);
return oac;
},
name: "Empty testcase"
@ -21,7 +21,7 @@ registerTestCase({
registerTestCase({
func: function () {
var oac = new OfflineAudioContext(1, 120 * samplerate, samplerate);
var oac = new OfflineAudioContext(1, DURATION * samplerate, samplerate);
var source0 = oac.createBufferSource();
source0.buffer = getSpecificFile({rate: oac.samplerate, channels:1});
source0.loop = true;
@ -34,7 +34,7 @@ registerTestCase({
registerTestCase({
func: function() {
var oac = new OfflineAudioContext(2, 120 * samplerate, samplerate);
var oac = new OfflineAudioContext(2, DURATION * samplerate, samplerate);
var source0 = oac.createBufferSource();
source0.buffer = getSpecificFile({rate: oac.samplerate, channels:2});
source0.loop = true;
@ -47,7 +47,7 @@ registerTestCase({
registerTestCase({
func: function () {
var oac = new OfflineAudioContext(2, 120 * samplerate, samplerate);
var oac = new OfflineAudioContext(2, DURATION * samplerate, samplerate);
var source0 = oac.createBufferSource();
var panner = oac.createPanner();
source0.buffer = getSpecificFile({rate: oac.samplerate, channels:2});
@ -64,7 +64,7 @@ registerTestCase({
registerTestCase({
func: function() {
var oac = new OfflineAudioContext(1, 120 * samplerate, samplerate);
var oac = new OfflineAudioContext(1, DURATION * samplerate, samplerate);
var source0 = oac.createBufferSource();
source0.buffer = getSpecificFile({rate: 38000, channels:1});
source0.loop = true;
@ -77,7 +77,7 @@ registerTestCase({
registerTestCase({
func: function() {
var oac = new OfflineAudioContext(2, 120 * samplerate, samplerate);
var oac = new OfflineAudioContext(2, DURATION * samplerate, samplerate);
var source0 = oac.createBufferSource();
source0.buffer = getSpecificFile({rate: 38000, channels:2});
source0.loop = true;
@ -90,7 +90,7 @@ registerTestCase({
registerTestCase({
func: function() {
var oac = new OfflineAudioContext(2, 120 * samplerate, samplerate);
var oac = new OfflineAudioContext(2, DURATION * samplerate, samplerate);
var source0 = oac.createBufferSource();
var panner = oac.createPanner();
source0.buffer = getSpecificFile({rate: 38000, channels:2});
@ -107,7 +107,7 @@ registerTestCase({
registerTestCase({
func: function() {
var oac = new OfflineAudioContext(2, 120 * samplerate, samplerate);
var oac = new OfflineAudioContext(2, DURATION * samplerate, samplerate);
var source0 = oac.createBufferSource();
source0.buffer = getSpecificFile({rate: oac.samplerate, channels:1});
source0.loop = true;
@ -120,7 +120,7 @@ registerTestCase({
registerTestCase({
func: function() {
var oac = new OfflineAudioContext(1, 120 * samplerate, samplerate);
var oac = new OfflineAudioContext(1, DURATION * samplerate, samplerate);
var source0 = oac.createBufferSource();
source0.buffer = getSpecificFile({rate: oac.samplerate, channels:2});
source0.loop = true;
@ -133,7 +133,7 @@ registerTestCase({
registerTestCase({
func: function() {
var oac = new OfflineAudioContext(2, 30 * samplerate, samplerate);
var oac = new OfflineAudioContext(2, DURATION * samplerate, samplerate);
for (var i = 0; i < 100; i++) {
var source0 = oac.createBufferSource();
source0.buffer = getSpecificFile({rate: 38000, channels:1});
@ -148,7 +148,7 @@ registerTestCase({
registerTestCase({
func: function() {
var oac = new OfflineAudioContext(2, 30 * samplerate, samplerate);
var oac = new OfflineAudioContext(2, DURATION * samplerate, samplerate);
var reference = getSpecificFile({rate: 38000, channels:1}).getChannelData(0);
for (var i = 0; i < 100; i++) {
var source0 = oac.createBufferSource();
@ -171,7 +171,7 @@ registerTestCase({
registerTestCase({
func: function() {
var oac = new OfflineAudioContext(2, 300 * samplerate, samplerate);
var oac = new OfflineAudioContext(2, DURATION * samplerate, samplerate);
var gain = oac.createGain();
gain.gain.value = -1;
gain.connect(oac.destination);
@ -201,7 +201,7 @@ registerTestCase({
registerTestCase({
func: function() {
var oac = new OfflineAudioContext(1, 30 * samplerate, samplerate);
var oac = new OfflineAudioContext(1, DURATION * samplerate, samplerate);
var i,l;
var decay = 10;
var duration = 4;
@ -231,8 +231,8 @@ registerTestCase({
registerTestCase({
func: function() {
var oac = new OfflineAudioContext(1, 30 * samplerate, samplerate);
var duration = 30 * samplerate;
var oac = new OfflineAudioContext(1, DURATION * samplerate, samplerate);
var duration = DURATION * samplerate;
var audiobuffer = getSpecificFile({rate: samplerate, channels:1});
var offset = 0;
while (offset < duration / samplerate) {
@ -262,7 +262,7 @@ registerTestCase({
registerTestCase({
func: function() {
var samplerate = 44100;
var duration = 30;
var duration = DURATION;
var oac = new OfflineAudioContext(1, duration * samplerate, 44100);
var offset = 0;
while (offset < duration) {
@ -287,7 +287,7 @@ registerTestCase({
registerTestCase({
func: function() {
var samplerate = 44100;
var duration = 30;
var duration = DURATION;
var oac = new OfflineAudioContext(1, duration * samplerate, samplerate);
var offset = 0;
var osc = oac.createOscillator();
@ -317,7 +317,7 @@ registerTestCase({
registerTestCase({
func: function () {
var oac = new OfflineAudioContext(2, 120 * samplerate, samplerate);
var oac = new OfflineAudioContext(2, DURATION * samplerate, samplerate);
var source0 = oac.createBufferSource();
var panner = oac.createStereoPanner();
source0.buffer = getSpecificFile({rate: oac.samplerate, channels:2});
@ -333,7 +333,7 @@ registerTestCase({
registerTestCase({
func: function () {
var oac = new OfflineAudioContext(2, 120 * samplerate, samplerate);
var oac = new OfflineAudioContext(2, DURATION * samplerate, samplerate);
var source0 = oac.createBufferSource();
var panner = oac.createStereoPanner();
source0.buffer = getSpecificFile({rate: oac.samplerate, channels:2});
@ -350,7 +350,7 @@ registerTestCase({
registerTestCase({
func: function () {
var oac = new OfflineAudioContext(2, 120 * samplerate, samplerate);
var oac = new OfflineAudioContext(2, DURATION * samplerate, samplerate);
var osc = oac.createOscillator();
osc.type = 'sawtooth';
var freq = 2000;

View File

@ -1,25 +0,0 @@
var OUTPUT_PATH="webaudio.json";
var benchmarks = require("./benchmarks.js");
var template = require("./template-row.json");
var dashboard = require("./webaudio-dashboard.json");
var fs = require('fs');
var str = JSON.stringify(template);
var names = benchmarks.benchmarks;
for (var i in benchmarks.benchmarks) {
["win", "linux", "mac", "android"].forEach(function(platform) {
var out = str.replace(/{{benchmark}}/g, names[i]).replace(/{{platform}}/g, platform);
dashboard.rows.push(JSON.parse(out));
});
}
fs.writeFile(OUTPUT_PATH, JSON.stringify(dashboard, " ", 2), function(err) {
if(err) {
return console.log(err);
}
console.log("grafana dashboard saved as " + OUTPUT_PATH);
});

View File

@ -34,7 +34,7 @@
<div class=controls>
<button id=run-all>Run all</button>
<div id=in-progress>
<progress> </progress>
<progress id=progress-bar> </progress>
Benchmark in progress...
</div>
</div>

View File

@ -1,79 +0,0 @@
{
"title": "{{benchmark}} -- {{platform}}",
"height": "250px",
"editable": true,
"collapse": true,
"panels": [
{
"title": "{{benchmark}} -- {{platform}}",
"error": false,
"span": 12,
"editable": true,
"type": "graph",
"id": 1,
"datasource": null,
"renderer": "flot",
"x-axis": true,
"y-axis": true,
"y_formats": [
"short",
"short"
],
"grid": {
"leftMax": null,
"rightMax": null,
"leftMin": null,
"rightMin": null,
"threshold1": null,
"threshold2": null,
"threshold1Color": "rgba(216, 200, 27, 0.27)",
"threshold2Color": "rgba(234, 112, 112, 0.22)"
},
"lines": true,
"fill": 0,
"linewidth": 1,
"points": true,
"pointradius": 5,
"bars": false,
"stack": false,
"percentage": false,
"legend": {
"show": true,
"values": false,
"min": false,
"max": false,
"current": false,
"total": false,
"avg": false,
"alignAsTable": false
},
"nullPointMode": "connected",
"steppedLine": false,
"tooltip": {
"value_type": "cumulative",
"shared": false
},
"targets": [
{
"function": "mean",
"column": "value",
"series": "benchmarks.webaudio-padenot.{{benchmark}}.{{platform}}.firefox.nightly",
"query": "select mean(value) from \"benchmarks.webaudio-padenot.{{benchmark}}.{{platform}}.firefox.nightly\" where $timeFilter group by time($interval) order asc",
"hide": false
},
{
"function": "mean",
"column": "value",
"series": "benchmarks.webaudio-padenot.{{benchmark}}.{{platform}}.chrome.canary",
"query": "select mean(value) from \"benchmarks.webaudio-padenot.{{benchmark}}.{{platform}}.chrome.canary\" where $timeFilter group by time($interval) order asc",
"hide": false,
"groupby_field": ""
}
],
"aliasColors": {},
"seriesOverrides": [],
"links": [],
"leftYAxisLabel": "Time in milliseconds, lower is better"
}
]
}

0
third_party/webkit/PerformanceTests/webaudio/update.sh vendored Normal file → Executable file
View File

View File

@ -3,6 +3,21 @@ if (window.AudioContext == undefined) {
window.OfflineAudioContext = window.webkitOfflineAudioContext;
}
$ = document.querySelectorAll.bind(document);
let DURATION = null;
if (location.search) {
let duration = location.search.match(/duration=(\d+)/);
if (duration) {
DURATION = duration[1];
} else {
DURATION = 120;
}
} else {
DURATION = 120;
}
// Global samplerate at which we run the context.
var samplerate = 48000;
// Array containing at first the url of the audio resources to fetch, and the
@ -133,8 +148,8 @@ function allDone() {
document.getElementById("run-all").disabled = false;
if (location.search == '?raptor') {
var _data = ['raptor-benchmark', 'webaudio', JSON.stringify(results)];
if (location.search.includes("raptor")) {
var _data = ['raptor-benchmark', 'webaudio', JSON.stringify(results)];
window.postMessage(_data, '*');
} else {
var xhr = new XMLHttpRequest();
@ -147,6 +162,7 @@ function allDone() {
function runOne(i) {
benchmark(testcases[i], function() {
i++;
$("#progress-bar")[0].value++;
if (i < testcases.length) {
runOne(i);
} else {
@ -156,6 +172,8 @@ function runOne(i) {
}
function runAll() {
$("#progress-bar")[0].max = testcases_registered.length;
$("#progress-bar")[0].value = 0;
initAll();
results = [];
runOne(0);
@ -192,9 +210,8 @@ document.addEventListener("DOMContentLoaded", function() {
runAll();
});
loadAllSources(function() {
document.getElementById("loading").style.display = "none";
document.getElementById("loading").remove();
document.getElementById("run-all").style.display = "inline";
document.getElementById("in-progress").style.display = "inline";
setTimeout(runAll, 100);
});
});

File diff suppressed because it is too large Load Diff