summaryrefslogtreecommitdiffstats
path: root/main.mjs
diff options
context:
space:
mode:
authorBrian Cully <bjc@spork.org>2025-08-23 12:16:01 -0400
committerBrian Cully <bjc@spork.org>2025-08-23 12:16:01 -0400
commit8ce858ce7a03090b3b2a1310d17b1206f097637f (patch)
tree1cfffdd378abc49f4d1f737b76a83f76224a14c8 /main.mjs
parent5b8962e35836cf7ccbfdbca312f6b0eb9269e2a6 (diff)
downloadautomathon-8ce858ce7a03090b3b2a1310d17b1206f097637f.tar.gz
automathon-8ce858ce7a03090b3b2a1310d17b1206f097637f.zip
add some benchmarking
Diffstat (limited to 'main.mjs')
-rw-r--r--main.mjs8
1 files changed, 8 insertions, 0 deletions
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;
}