]> Piment Noir Git Repositories - benchmarks-js.git/commitdiff
fix(bench): disable warmup for slow busy-wait benchmarks
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 10 Feb 2026 21:38:44 +0000 (22:38 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 10 Feb 2026 21:38:44 +0000 (22:38 +0100)
Tinybench's default warmup phase caused timeouts with 2-second busy-wait
functions. Disable warmup and set minimum iterations for proper measurement.

busy-wait.mjs

index dbf6c5987115ba651833dc42b156c85e410aa93a..20ec30a2bca4ba050b1a52ac1a7ef20ef73e6c44 100644 (file)
@@ -67,7 +67,12 @@ async function sleepTimeoutBusyWait (timeoutMs, intervalMs = interval) {
   } while (performance.now() < timeoutTimestampMs)
 }
 
-const bench = new Bench({ name: 'Busy wait', time: timeout + interval })
+const bench = new Bench({
+  iterations: 2,
+  name: 'Busy wait',
+  time: 5000,
+  warmup: false,
+})
 
 bench.add('dummyTimeoutBusyWait', () => {
   dummyTimeoutBusyWait(timeout)