for (let i = 0; i < size; i++) {
object[i.toString()] = numberGenerator(numberMax)
}
- return { object, size }
+ return object
}
/**
const _ = require('lodash')
const clone = require('just-clone')
-const { object, size } = generateRandomObject()
+const object = generateRandomObject()
Benchmark.suite(
- `Deep clone object with ${size} keys`,
+ `Deep clone object with ${Object.keys(object).length} keys`,
Benchmark.add('JSON stringify/parse', (obj = object) => {
const objClone = JSON.parse(JSON.stringify(obj))
}),
const Benchmark = require('benny')
const { generateRandomObject } = require('./benchmark-utils')
-const { object, size } = generateRandomObject()
+const object = generateRandomObject()
Benchmark.suite(
- `Is empty object with ${size} keys`,
+ `Is empty object with ${Object.keys(object).length} keys`,
Benchmark.add('Reflect keys', (obj = object) => {
return obj?.constructor === Object && Reflect.ownKeys(obj).length === 0
}),
const { generateRandomObject } = require('./benchmark-utils')
const _ = require('lodash')
-const { object, size } = generateRandomObject()
+const object = generateRandomObject()
Benchmark.suite(
- `Shallow clone object with ${size} keys`,
+ `Shallow clone object with ${Object.keys(object).length} keys`,
Benchmark.add('Spread', (obj = object) => {
const objClone = { ...obj }
}),