2 import { isEmpty } from 'rambda'
3 import { bench, group, run } from 'tatami-ng'
5 import { generateRandomObject } from './benchmark-utils.mjs'
7 const object = generateRandomObject()
9 group(`Is empty object with ${Object.keys(object).length} keys`, () => {
10 bench('Reflect keys', (obj = object) => {
11 return obj?.constructor === Object && Reflect.ownKeys(obj).length === 0
13 bench('Keys iteration', (obj = object) => {
14 if (obj?.constructor !== Object) return false
15 // Iterates over the keys of an object, if
16 // any exist, return false.
17 // eslint-disable-next-line no-unreachable-loop
18 for (const _ in obj) return false
21 bench('Object keys', (obj = object) => {
22 return obj?.constructor === Object && Object.keys(obj).length === 0
24 bench('lodash isEmpty', (obj = object) => {
27 bench('rambda isEmpty', (obj = object) => {