]> Piment Noir Git Repositories - benchmarks-js.git/commitdiff
refactor(bench): migrate from tatami-ng to tinybench
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 10 Feb 2026 21:12:12 +0000 (22:12 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 10 Feb 2026 21:12:12 +0000 (22:12 +0100)
- Migrated 16 benchmark files from tatami-ng to tinybench API
- Replaced group/bench/run pattern with Bench class
- Added console.table() output for all benchmarks
- Removed tatami-ng dependency (already done in previous commit)
- All benchmarks verified working

Note: busy-wait.mjs has pre-existing timeout issue (documented in notepad)
Note: round-robin-index.mjs referenced in plan does not exist in repository

18 files changed:
busy-wait.mjs
deep-clone-object.mjs
deep-merge-object.mjs
empty-array.mjs
fibonacci.mjs
is-empty-object.mjs
is-undefined.mjs
json-stringify.mjs
max.mjs
min.mjs
object-hash.mjs
package.json
pnpm-lock.yaml
promise-handling.mjs
quick-select.mjs
random.mjs
shallow-clone-object.mjs
uuid-generator.mjs

index 3cbe0762ffbec24eacc9e8a79f6628a331e4c585..d547be9ce727c29ad06d872057d7c52705074cc5 100644 (file)
@@ -1,4 +1,4 @@
-import { bench, group, run } from 'tatami-ng'
+import { Bench } from 'tinybench'
 
 import { sleep } from './benchmark-utils.mjs'
 
@@ -67,21 +67,20 @@ async function sleepTimeoutBusyWait (timeoutMs, intervalMs = interval) {
   } while (performance.now() < timeoutTimestampMs)
 }
 
-group('Busy wait', () => {
-  bench('dummyTimeoutBusyWait', () => {
-    dummyTimeoutBusyWait(timeout)
-  })
-  bench('sleepTimeoutBusyWait', async () => {
-    await sleepTimeoutBusyWait(timeout)
-  })
-  bench('divideAndConquerTimeoutBusyWait', async () => {
-    await divideAndConquerTimeoutBusyWait(timeout)
-  })
-  bench('setIntervalTimeoutBusyWait', async () => {
-    await setIntervalTimeoutBusyWait(timeout)
-  })
-})
+const bench = new Bench({ name: 'Busy wait', time: timeout })
 
-await run({
-  units: true,
+bench.add('dummyTimeoutBusyWait', () => {
+  dummyTimeoutBusyWait(timeout)
 })
+bench.add('sleepTimeoutBusyWait', async () => {
+  await sleepTimeoutBusyWait(timeout)
+})
+bench.add('divideAndConquerTimeoutBusyWait', async () => {
+  await divideAndConquerTimeoutBusyWait(timeout)
+})
+bench.add('setIntervalTimeoutBusyWait', async () => {
+  await setIntervalTimeoutBusyWait(timeout)
+})
+
+await bench.run()
+console.table(bench.table())
index eda04d0d83e47d52ae7d6340dc8940bbf69bb5c9..88c1bc1c5e9447ac64f3bdba46ca66b276edc47f 100644 (file)
@@ -1,34 +1,34 @@
 import deepClone from 'deep-clone'
 import clone from 'just-clone'
 import _ from 'lodash'
-import { clone as rambdaClone } from 'rambda'
-import { bench, group, run } from 'tatami-ng'
+import { Bench } from 'tinybench'
 
 import { generateRandomObject } from './benchmark-utils.mjs'
 
 const object = generateRandomObject()
 
-group(`Deep clone object with ${Object.keys(object).length} keys`, () => {
-  bench('JSON stringify/parse', (obj = object) => {
+const bench = new Bench({
+  name: `Deep clone object (${JSON.stringify(object)})`,
+  time: 100,
+})
+
+bench
+  .add('JSON stringify/parse', (obj = object) => {
     JSON.parse(JSON.stringify(obj))
   })
-  bench('structuredClone', (obj = object) => {
+  .add('structuredClone', (obj = object) => {
     structuredClone(obj)
   })
-  bench('lodash cloneDeep', (obj = object) => {
+  .add('lodash cloneDeep', (obj = object) => {
     _.cloneDeep(obj)
   })
-  bench('rambda clone', (obj = object) => {
-    rambdaClone(obj)
-  })
-  bench('just-clone', (obj = object) => {
+  .add('just-clone', (obj = object) => {
     clone(obj)
   })
-  bench('deep-clone', (obj = object) => {
+  .add('deep-clone', (obj = object) => {
     deepClone(obj)
   })
-})
 
-await run({
-  units: true,
-})
+await bench.run()
+
+console.table(bench.table())
index b36b800057c452f665c66cca7e048e98fb30897f..ba35176b3be0538c89cbdd66f37a0353c58108b6 100644 (file)
@@ -1,30 +1,31 @@
 import deepMerge from 'deepmerge'
 import _ from 'lodash'
-import { mergeDeepRight } from 'rambda'
-import { bench, group, run } from 'tatami-ng'
+import { merge as rambdaMerge } from 'rambda'
+import { Bench } from 'tinybench'
 
 import { generateRandomObject } from './benchmark-utils.mjs'
 
 const object = generateRandomObject()
 const objectToMerge = generateRandomObject()
 
-group(
-  `Deep merge two objects: object with ${
+const bench = new Bench({
+  name: `Deep merge two objects: object with ${
     Object.keys(object).length
   } keys, object with ${Object.keys(objectToMerge).length} keys`,
-  () => {
-    bench('lodash merge', (obj = object) => {
-      _.merge(obj, objectToMerge)
-    })
-    bench('rambda mergeDeepRight', (obj = object) => {
-      mergeDeepRight(obj, objectToMerge)
-    })
-    bench('deepmerge', (obj = object) => {
-      deepMerge(obj, objectToMerge)
-    })
-  }
-)
-
-await run({
-  units: true,
+  time: 100,
 })
+
+bench
+  .add('lodash merge', (obj = object) => {
+    _.merge(obj, objectToMerge)
+  })
+  .add('rambda merge', (obj = object) => {
+    rambdaMerge(obj, objectToMerge)
+  })
+  .add('deepmerge', (obj = object) => {
+    deepMerge(obj, objectToMerge)
+  })
+
+await bench.run()
+
+console.table(bench.table())
index 27cdca29ad0f6228883f4b0630a2ab81262723f7..9439da7cbee5194f17bcb3af49040b2288a0eb16 100644 (file)
@@ -1,32 +1,36 @@
-import { bench, group, run } from 'tatami-ng'
+import { Bench } from 'tinybench'
 
 import { generateRandomNumberArray } from './benchmark-utils.mjs'
 
 const size = 10000
 let testArray = generateRandomNumberArray(size)
 
-group(`Empty array with ${size} elements`, () => {
-  bench('length = 0', () => {
+const bench = new Bench({
+  name: `Empty array with ${size} elements`,
+  time: 100,
+})
+
+bench
+  .add('length = 0', () => {
     testArray.length = 0
   })
-  bench('pop loop', () => {
+  .add('pop loop', () => {
     while (testArray.length > 0) {
       testArray.pop()
     }
   })
-  bench('splice', () => {
+  .add('splice', () => {
     testArray.splice(0, testArray.length)
   })
-  bench('shift loop', () => {
+  .add('shift loop', () => {
     while (testArray.length > 0) {
       testArray.shift()
     }
   })
-  bench('initialize', () => {
+  .add('initialize', () => {
     testArray = []
   })
-})
 
-await run({
-  units: true,
-})
+await bench.run()
+
+console.table(bench.table())
index c0cc843944018c4f33469b3a1d40f2e4d8ffbf1e..4814e4b0187c0ec377d6b12128cd5715168e3072 100644 (file)
@@ -1,4 +1,4 @@
-import { bench, group, run } from 'tatami-ng'
+import { Bench } from 'tinybench'
 
 const number = 30
 
@@ -60,21 +60,22 @@ function fibonacciRecursionMemoization (num, memo) {
     fibonacciRecursionMemoization(num - 2, memo))
 }
 
-group(`Fibonacci number ${number}`, () => {
-  bench('fibonacciLoop', () => {
+const bench = new Bench({ name: `Fibonacci number ${number}` })
+
+bench
+  .add('fibonacciLoop', () => {
     fibonacciLoop(number)
   })
-  bench('fibonacciLoopWhile', () => {
+  .add('fibonacciLoopWhile', () => {
     fibonacciLoopWhile(number)
   })
-  bench('fibonacciRecursion', () => {
+  .add('fibonacciRecursion', () => {
     fibonacciRecursion(number)
   })
-  bench('fibonacciRecursionMemoization', () => {
+  .add('fibonacciRecursionMemoization', () => {
     fibonacciRecursionMemoization(number)
   })
-})
 
-await run({
-  units: true,
-})
+await bench.run()
+
+console.table(bench.results)
index 45ac8e3a44ced93a146913733292d3e1c1ac143b..ae5647ae6f34cc2c4f89fc34809caf61cf6ecddc 100644 (file)
@@ -1,16 +1,20 @@
 import _ from 'lodash'
-import { isEmpty } from 'rambda'
-import { bench, group, run } from 'tatami-ng'
+import { Bench } from 'tinybench'
 
 import { generateRandomObject } from './benchmark-utils.mjs'
 
 const object = generateRandomObject()
 
-group(`Is empty object with ${Object.keys(object).length} keys`, () => {
-  bench('Reflect keys', (obj = object) => {
+const bench = new Bench({
+  name: `Is empty object with ${Object.keys(object).length} keys`,
+  time: 100,
+})
+
+bench
+  .add('Reflect keys', (obj = object) => {
     return obj?.constructor === Object && Reflect.ownKeys(obj).length === 0
   })
-  bench('Keys iteration', (obj = object) => {
+  .add('Keys iteration', (obj = object) => {
     if (obj?.constructor !== Object) return false
     // Iterates over the keys of an object, if
     // any exist, return false.
@@ -18,17 +22,13 @@ group(`Is empty object with ${Object.keys(object).length} keys`, () => {
     for (const _ in obj) return false
     return true
   })
-  bench('Object keys', (obj = object) => {
+  .add('Object keys', (obj = object) => {
     return obj?.constructor === Object && Object.keys(obj).length === 0
   })
-  bench('lodash isEmpty', (obj = object) => {
+  .add('lodash isEmpty', (obj = object) => {
     _.isEmpty(obj)
   })
-  bench('rambda isEmpty', (obj = object) => {
-    isEmpty(obj)
-  })
-})
 
-await run({
-  units: true,
-})
+await bench.run()
+
+console.table(bench.table())
index 933f6a24acf7c06e054394ad17593d487da853b2..965c80f2838923a955886f76e89750d31d5114a6 100644 (file)
@@ -1,14 +1,18 @@
-import { bench, group, run } from 'tatami-ng'
+import { Bench } from 'tinybench'
 
-group('Is undefined', () => {
-  bench('=== undefined', (value = undefined) => {
+const bench = new Bench({
+  name: 'Is undefined',
+  time: 100,
+})
+
+bench
+  .add('=== undefined', (value = undefined) => {
     return value === undefined
   })
-  bench("typeof === 'undefined'", (value = undefined) => {
+  .add("typeof === 'undefined'", (value = undefined) => {
     return typeof value === 'undefined'
   })
-})
 
-await run({
-  units: true,
-})
+await bench.run()
+
+console.table(bench.table())
index 2e44e30bf23b7b66b6ba76a77a9e473a2bcd564d..87604ae5e588ce7cf7f1a2987f7a9db6f83a895d 100644 (file)
@@ -1,4 +1,4 @@
-import { bench, group, run } from 'tatami-ng'
+import { Bench } from 'tinybench'
 
 const sampleObj = {
   address: {
@@ -11,12 +11,15 @@ const sampleObj = {
   name: 'Sid',
 }
 
-group('JSON stringify', () => {
-  bench('JSON.stringify', () => {
-    JSON.stringify(sampleObj)
-  })
+const bench = new Bench({
+  name: 'JSON stringify',
+  time: 100,
 })
 
-await run({
-  units: true,
+bench.add('JSON.stringify', () => {
+  JSON.stringify(sampleObj)
 })
+
+await bench.run()
+
+console.table(bench.table())
diff --git a/max.mjs b/max.mjs
index 2b43541184100fad8ba0455f56e9726839df74b0..a43ce5cb6b381c1da683ce1d97a5cf02138e2f81 100644 (file)
--- a/max.mjs
+++ b/max.mjs
@@ -1,4 +1,4 @@
-import { bench, group, run } from 'tatami-ng'
+import { Bench } from 'tinybench'
 
 import { generateRandomNumberArray } from './benchmark-utils.mjs'
 
@@ -51,24 +51,28 @@ function sortMax (values) {
   return values.sort((a, b) => b - a)[0]
 }
 
-group(`Max from ${size} numbers`, () => {
-  bench('Math.max', () => {
+const bench = new Bench({
+  name: `Max from ${size} numbers`,
+  time: 100,
+})
+
+bench
+  .add('Math.max', () => {
     Math.max(...testArray)
   })
-  bench('loopMax', () => {
+  .add('loopMax', () => {
     loopMax(testArray)
   })
-  bench('reduceTernaryMax', () => {
+  .add('reduceTernaryMax', () => {
     reduceTernaryMax(testArray)
   })
-  bench('reduceMathMax', () => {
+  .add('reduceMathMax', () => {
     reduceMathMax(testArray)
   })
-  bench('sortMax', () => {
+  .add('sortMax', () => {
     sortMax(testArray)
   })
-})
 
-await run({
-  units: true,
-})
+await bench.run()
+
+console.table(bench.table())
diff --git a/min.mjs b/min.mjs
index 2e5e4070067d10ab956b4ac2660b54902b04fb31..c95b4ae96ed93ea6030e94073d60a8292ff490e9 100644 (file)
--- a/min.mjs
+++ b/min.mjs
@@ -1,4 +1,4 @@
-import { bench, group, run } from 'tatami-ng'
+import { Bench } from 'tinybench'
 
 import { generateRandomNumberArray } from './benchmark-utils.mjs'
 
@@ -51,24 +51,28 @@ function sortMin (values) {
   return values.sort((a, b) => a - b)[0]
 }
 
-group(`Min from ${size} numbers`, () => {
-  bench('Math.min', () => {
+const bench = new Bench({
+  name: `Min from ${size} numbers`,
+  time: 100,
+})
+
+bench
+  .add('Math.min', () => {
     Math.min(...testArray)
   })
-  bench('loopMin', () => {
+  .add('loopMin', () => {
     loopMin(testArray)
   })
-  bench('reduceTernaryMin', () => {
+  .add('reduceTernaryMin', () => {
     reduceTernaryMin(testArray)
   })
-  bench('reduceMathMin', () => {
+  .add('reduceMathMin', () => {
     reduceMathMin(testArray)
   })
-  bench('sortMin', () => {
+  .add('sortMin', () => {
     sortMin(testArray)
   })
-})
 
-await run({
-  units: true,
-})
+await bench.run()
+
+console.table(bench.table())
index 4db16e1fe34899c896754bc1afcc0d115f53b274..1eb8ad4739328039aa215db891d8ed4133e25fb4 100644 (file)
@@ -1,24 +1,28 @@
 import hashObject from 'hash-object'
 import { hasher } from 'node-object-hash'
 import hash from 'object-hash'
-import { bench, group, run } from 'tatami-ng'
+import { Bench } from 'tinybench'
 
 import { generateRandomObject } from './benchmark-utils.mjs'
 
 const object = generateRandomObject()
 
-group(`Hash object with ${Object.keys(object).length} keys`, () => {
-  bench('hash-object', (obj = object) => {
+const bench = new Bench({
+  name: `Hash object with ${Object.keys(object).length} keys`,
+  time: 100,
+})
+
+bench
+  .add('hash-object', (obj = object) => {
     return hashObject(obj, { algorithm: 'sha256' })
   })
-  bench('node-object-hash', (obj = object) => {
+  .add('node-object-hash', (obj = object) => {
     return hasher({ alg: 'sha256' }).hash(obj)
   })
-  bench('object-hash', (obj = object) => {
+  .add('object-hash', (obj = object) => {
     return hash(obj, { algorithm: 'sha256' })
   })
-})
 
-await run({
-  units: true,
-})
+await bench.run()
+
+console.table(bench.table())
index a99bbd7e3c1c28aa506bebc26ebe46d5da00e9f1..9f36d9b31e026a21d40d444f53b382c545dfc34f 100644 (file)
@@ -70,7 +70,6 @@
     "node-object-hash": "^3.1.1",
     "object-hash": "^3.0.0",
     "rambda": "^11.1.0",
-    "tatami-ng": "^0.8.18",
     "tinybench": "^6.0.0",
     "uuid": "^13.0.0"
   },
index 7a69d1bd5d95840bb451909a3dc44556302c5d90..4861a77a21ed96ac2bcf571a2cee6b7cc250aec8 100644 (file)
@@ -35,9 +35,6 @@ importers:
       rambda:
         specifier: ^11.1.0
         version: 11.1.0
-      tatami-ng:
-        specifier: ^0.8.18
-        version: 0.8.18(typescript@5.9.3)
       tinybench:
         specifier: ^6.0.0
         version: 6.0.0
@@ -1713,12 +1710,6 @@ packages:
     resolution: {integrity: sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==}
     engines: {node: '>=6'}
 
-  tatami-ng@0.8.18:
-    resolution: {integrity: sha512-Q22ZpW/yPXP1Hb4e2s1JQcTtoMaVHZLCt8AjAyBjARiXcorgHyvuWyIPFJOvmrTglXU2qQPLqL+7HEE0tIHdiA==}
-    hasBin: true
-    peerDependencies:
-      typescript: ^5.4.3
-
   tinybench@6.0.0:
     resolution: {integrity: sha512-BWlWpVbbZXaYjRV0twGLNQO00Zj4HA/sjLOQP2IvzQqGwRGp+2kh7UU3ijyJ3ywFRogYDRbiHDMrUOfaMnN56g==}
     engines: {node: '>=20.0.0'}
@@ -3689,11 +3680,6 @@ snapshots:
 
   tapable@2.3.0: {}
 
-  tatami-ng@0.8.18(typescript@5.9.3):
-    dependencies:
-      peowly: 1.3.2
-      typescript: 5.9.3
-
   tinybench@6.0.0: {}
 
   tinyexec@1.0.2: {}
index 5ace30e862052584859f7cd028b334beaada6ed5..99246ece680ae5029d9c8714da469cb1de9ab4a5 100644 (file)
@@ -1,4 +1,4 @@
-import { bench, group, run } from 'tatami-ng'
+import { Bench } from 'tinybench'
 
 /**
  *
@@ -9,30 +9,34 @@ async function asyncFunction () {
   })
 }
 
-group('Promise handling', () => {
-  bench('await promise', async () => {
+const bench = new Bench({
+  name: 'Promise handling',
+  time: 100,
+})
+
+bench
+  .add('await promise', async () => {
     try {
       return await asyncFunction()
     } catch (e) {
       console.error(e)
     }
   })
-  bench('promise with then().catch()', () => {
+  .add('promise with then().catch()', () => {
     asyncFunction()
       .then(r => {
         return r
       })
       .catch(console.error)
   })
-  bench('voided promise', () => {
+  .add('voided promise', () => {
     // eslint-disable-next-line no-void
     void asyncFunction()
   })
-  bench('mishandled promise', () => {
+  .add('mishandled promise', () => {
     asyncFunction()
   })
-})
 
-await run({
-  units: true,
-})
+await bench.run()
+
+console.table(bench.table())
index 645cad213f84d551f0a445b5f99eb75ef445ba44..8c27589e57b3ffa5d5f5f7e4b4af236c87a5a0c6 100644 (file)
@@ -1,5 +1,5 @@
 import { randomInt } from 'node:crypto'
-import { bench, group, run } from 'tatami-ng'
+import { Bench } from 'tinybench'
 
 /**
  * Generates a random tasks map for benchmarking.
@@ -242,27 +242,26 @@ function swap (array, index1, index2) {
   array[index2] = tmp
 }
 
-group('Quick select', () => {
-  bench('Loop select', () => {
-    loopSelect(tasksMap)
-  })
-  bench('Array sort select', () => {
-    arraySortSelect(tasksMap)
-  })
-  bench('Quick select loop', () => {
-    quickSelectLoop(tasksMap)
-  })
-  bench('Quick select loop with random pivot', () => {
-    quickSelectLoopRandomPivot(tasksMap)
-  })
-  bench('Quick select recursion', () => {
-    quickSelectRecursion(tasksMap)
-  })
-  bench('Quick select recursion with random pivot', () => {
-    quickSelectRecursionRandomPivot(tasksMap)
-  })
-})
+const bench = new Bench({ name: 'Quick select', time: 100 })
 
-await run({
-  units: true,
+bench.add('Loop select', () => {
+  loopSelect(tasksMap)
 })
+bench.add('Array sort select', () => {
+  arraySortSelect(tasksMap)
+})
+bench.add('Quick select loop', () => {
+  quickSelectLoop(tasksMap)
+})
+bench.add('Quick select loop with random pivot', () => {
+  quickSelectLoopRandomPivot(tasksMap)
+})
+bench.add('Quick select recursion', () => {
+  quickSelectRecursion(tasksMap)
+})
+bench.add('Quick select recursion with random pivot', () => {
+  quickSelectRecursionRandomPivot(tasksMap)
+})
+
+await bench.run()
+console.table(bench.table())
index f5aac7b8edc6d3f9e0283a18d6e1f565cde61813..62da4b524412fe306a900a84aa47902f1a63359c 100644 (file)
@@ -1,5 +1,5 @@
 import { randomInt } from 'node:crypto'
-import { bench, group, run } from 'tatami-ng'
+import { Bench } from 'tinybench'
 
 import {
   secureRandom,
@@ -65,21 +65,20 @@ function getSecureRandomIntegerWithRandomValues (
   return Math.floor(secureRandomWithRandomValues() * (max + 1))
 }
 
-group('Random Integer Generator', () => {
-  bench('Secure random integer generator', () => {
-    getSecureRandomInteger(maximum)
-  })
-  bench('Secure random with getRandomValues() integer generator', () => {
-    getSecureRandomIntegerWithRandomValues(maximum)
-  })
-  bench('Crypto random integer generator', () => {
-    randomInt(maximum)
-  })
-  bench('Math random integer generator', () => {
-    getRandomInteger(maximum)
-  })
-})
+const bench = new Bench({ name: 'Random Integer Generator', time: 100 })
 
-await run({
-  units: true,
+bench.add('Secure random integer generator', () => {
+  getSecureRandomInteger(maximum)
+})
+bench.add('Secure random with getRandomValues() integer generator', () => {
+  getSecureRandomIntegerWithRandomValues(maximum)
+})
+bench.add('Crypto random integer generator', () => {
+  randomInt(maximum)
 })
+bench.add('Math random integer generator', () => {
+  getRandomInteger(maximum)
+})
+
+await bench.run()
+console.table(bench.table())
index c207d19dcfcb1f875c7461a9c2f9c78b498b1b4a..d4a0d8b250136af8ea463f21726e234e31e3e808 100644 (file)
@@ -1,22 +1,24 @@
 import _ from 'lodash'
-import { bench, group, run } from 'tatami-ng'
+import { Bench } from 'tinybench'
 
 import { generateRandomObject } from './benchmark-utils.mjs'
 
 const object = generateRandomObject()
 
-group(`Shallow clone object with ${Object.keys(object).length} keys`, () => {
-  bench('Spread', () => {
-    return { ...object }
-  })
-  bench('Object assign', () => {
-    return Object.assign({}, object)
-  })
-  bench('lodash clone', () => {
-    _.clone(object)
-  })
+const bench = new Bench({
+  name: `Shallow clone object with ${Object.keys(object).length} keys`,
+  time: 100,
 })
 
-await run({
-  units: true,
+bench.add('Spread', () => {
+  return { ...object }
 })
+bench.add('Object assign', () => {
+  return Object.assign({}, object)
+})
+bench.add('lodash clone', () => {
+  _.clone(object)
+})
+
+await bench.run()
+console.table(bench.table())
index 029940fa87f1c62df443277fe4af5da952dbe885..7012a557c4407b891db5cbef5024ae0547281656 100644 (file)
@@ -1,16 +1,15 @@
 import { randomUUID } from 'node:crypto'
-import { bench, group, run } from 'tatami-ng'
+import { Bench } from 'tinybench'
 import { v4 as uuid } from 'uuid'
 
-group('UUIDv4 generator', () => {
-  bench('randomUUID', () => {
-    randomUUID()
-  })
-  bench('uuid', () => {
-    uuid()
-  })
-})
+const bench = new Bench({ name: 'UUIDv4 generator', time: 100 })
 
-await run({
-  units: true,
+bench.add('randomUUID', () => {
+  randomUUID()
+})
+bench.add('uuid', () => {
+  uuid()
 })
+
+await bench.run()
+console.table(bench.table())