1 import hashObject from 'hash-object'
2 import { hasher } from 'node-object-hash'
3 import hash from 'object-hash'
4 import { bench, group, run } from 'tatami-ng'
6 import { generateRandomObject } from './benchmark-utils.mjs'
8 const object = generateRandomObject()
10 group(`Hash object with ${Object.keys(object).length} keys`, () => {
11 bench('hash-object', (obj = object) => {
12 return hashObject(obj, { algorithm: 'sha256' })
14 bench('node-object-hash', (obj = object) => {
15 return hasher({ alg: 'sha256' }).hash(obj)
17 bench('object-hash', (obj = object) => {
18 return hash(obj, { algorithm: 'sha256' })