From 93e39760b995cc23947529e3970555e73c7eca45 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 5 Oct 2017 00:02:37 +0200 Subject: [PATCH] Wasm: add basic benchmark Not really fair yet since the script isn't preloaded --- test/default/index.html.tpl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/default/index.html.tpl b/test/default/index.html.tpl index 8611ba7e..72f35cbb 100644 --- a/test/default/index.html.tpl +++ b/test/default/index.html.tpl @@ -42,8 +42,10 @@ function runTest(tname) { document.getElementById('test-res').appendChild(p); if (idx >= expected.length) { if (passed) { - hn.appendChild(document.createTextNode(' - PASSED')); - hn.className = 'passed'; + performance.measure('bench', 'bench_start', 'bench_end'); + let duration = performance.getEntriesByName('bench')[0].duration; + hn.appendChild(document.createTextNode(' - PASSED (time: ' + duration + ')')); + hn.className = 'passed'; } else { hn.appendChild(document.createTextNode(' - FAILED')); hn.className = 'err'; @@ -75,6 +77,7 @@ function runTest(tname) { var st = document.createElement('script'); st.src = tname + '.js'; s.parentNode.insertBefore(st, s); + performance.mask('bench_end'); } xhr.send(null); }