-import Benchmark from 'benny'
+import { bench, group, run } from 'tatami-ng'
+
import { generateRandomNumberArray } from './benchmark-utils.mjs'
const size = 10000
return values.sort((a, b) => b - a)[0]
}
-Benchmark.suite(
- `Max from ${size} numbers`,
- Benchmark.add('Math.max', () => {
+group(`Max from ${size} numbers`, () => {
+ bench('Math.max', () => {
Math.max(...testArray)
- }),
- Benchmark.add('loopMax', () => {
+ })
+ bench('loopMax', () => {
loopMax(testArray)
- }),
- Benchmark.add('reduceTernaryMax', () => {
+ })
+ bench('reduceTernaryMax', () => {
reduceTernaryMax(testArray)
- }),
- Benchmark.add('reduceMath.max', () => {
+ })
+ bench('reduceMathMax', () => {
reduceMathMax(testArray)
- }),
- Benchmark.add('sortMax', () => {
+ })
+ bench('sortMax', () => {
sortMax(testArray)
- }),
- Benchmark.cycle(),
- Benchmark.complete(),
- Benchmark.save({ file: 'max', format: 'json', details: true }),
- Benchmark.save({ file: 'max', format: 'chart.html', details: true }),
- Benchmark.save({ file: 'max', format: 'table.html', details: true })
-).catch((err) => {
- console.error(err)
+ })
+})
+
+await run({
+ units: true
})