From 8ce858ce7a03090b3b2a1310d17b1206f097637f Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Sat, 23 Aug 2025 12:16:01 -0400 Subject: add some benchmarking --- main.mjs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'main.mjs') diff --git a/main.mjs b/main.mjs index 908aaa2..bcb7f0a 100644 --- a/main.mjs +++ b/main.mjs @@ -46,6 +46,14 @@ async function loaded() { }; document.querySelector('#run').onclick = e => { console.debug('run clicked', e); + const start = performance.now(); + let tickCount = 0; + for (let i = 0; i < 1_000_000; i++) { + tickCount += interp.run(); + } + const end = performance.now(); + console.info(`run took ${end-start} ms for ${tickCount} ticks (${(end-start)/tickCount * 1000000} µs/tick).`); + console.info('result', interp.stack()); }; window.interp = interp; } -- cgit v1.3