X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=busy-wait.mjs;h=04aa41b0ccc594ea86263418299e1beaf50ea1a6;hb=ab9a08f3b8fdd43f8714e90652028621849f9f58;hp=e5aaaeaa91a30b8bd2989ed665035a6d8b3a6e1c;hpb=1b4e2f913afc4f5dfed823720d89dde05d23d184;p=benchmarks-js.git diff --git a/busy-wait.mjs b/busy-wait.mjs index e5aaaea..04aa41b 100644 --- a/busy-wait.mjs +++ b/busy-wait.mjs @@ -1,4 +1,4 @@ -import Benchmark from 'benny' +import { bench, group, run } from 'mitata' import { sleep } from './benchmark-utils.mjs' @@ -59,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 +})