X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=busy-wait.mjs;h=ec8a70d816cf8272e5d0af0ca44e3ca3dd45dc9b;hb=HEAD;hp=eeef8fed05b791d348218e6d5971dea0da6c64d7;hpb=4aa2893a787119ef9b3957e82539fee4fad4f98f;p=benchmarks-js.git diff --git a/busy-wait.mjs b/busy-wait.mjs index eeef8fe..dd9f691 100644 --- a/busy-wait.mjs +++ b/busy-wait.mjs @@ -1,4 +1,5 @@ -import Benchmark from 'benny' +import { bench, group, run } from 'tatami-ng' + import { sleep } from './benchmark-utils.mjs' const timeout = 2000 @@ -58,23 +59,21 @@ async function setIntervalTimeoutBusyWait (timeoutMs, intervalMs = interval) { }) } -Benchmark.suite( - 'Busy wait', - Benchmark.add('dummyTimeoutBusyWait', () => { +group('Busy wait', () => { + bench('dummyTimeoutBusyWait', () => { dummyTimeoutBusyWait(timeout) - }), - Benchmark.add('sleepTimeoutBusyWait', async () => { + }) + bench('sleepTimeoutBusyWait', async () => { await sleepTimeoutBusyWait(timeout) - }), - Benchmark.add('divideAndConquerTimeoutBusyWait', async () => { + }) + bench('divideAndConquerTimeoutBusyWait', async () => { await divideAndConquerTimeoutBusyWait(timeout) - }), - Benchmark.add('setIntervalTimeoutBusyWait', async () => { + }) + bench('setIntervalTimeoutBusyWait', async () => { await setIntervalTimeoutBusyWait(timeout) - }), - Benchmark.cycle(), - Benchmark.complete(), - Benchmark.save({ file: 'busy-wait', format: 'json', details: true }), - Benchmark.save({ file: 'busy-wait', format: 'chart.html', details: true }), - Benchmark.save({ file: 'busy-wait', format: 'table.html', details: true }) -).catch(console.error) + }) +}) + +await run({ + units: true, +})