-import Benchmark from 'benny'
+import { bench, group, run } from 'tatami-ng'
+
import { sleep } from './benchmark-utils.mjs'
const timeout = 2000
})
}
-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(err => {
- console.error(err)
+ })
+})
+
+await run({
+ units: true,
})