18c396dc4d72f9e348e3be108be4a44b3d4c52ea
1 /* eslint-disable no-unused-vars */
2 const Benchmark
= require('benny')
3 const { generateRandomObject
} = require('./benchmark-utils')
4 const _
= require('lodash')
6 const { object
, size
} = generateRandomObject()
9 `Shallow clone object with ${size} 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',