1 /* eslint-disable no-unused-vars */
2 import Benchmark from 'benny'
4 import { generateRandomObject } from './benchmark-utils.mjs'
6 const object = generateRandomObject()
9 `Shallow clone object with ${Object.keys(object).length} keys`,
10 Benchmark.add('Spread', (obj = object) => {
11 const objClone = { ...obj }
13 Benchmark.add('Object assign', (obj = object) => {
14 const objClone = Object.assign({}, obj)
16 Benchmark.add('lodash clone', (obj = object) => {
17 const objClone = _.clone(obj)
22 file: 'shallow-clone-object',
27 file: 'shallow-clone-object',
32 file: 'shallow-clone-object',
36 ).catch(console.error)