build(deps-dev): apply updates
[benchmarks-js.git] / shallow-clone-object.mjs
1 import _ from 'lodash'
2 import { assoc } from 'rambda'
3 import { bench, group, run } from 'tatami-ng'
4
5 import { generateRandomObject } from './benchmark-utils.mjs'
6
7 const object = generateRandomObject()
8
9 group(`Shallow clone object with ${Object.keys(object).length} keys`, () => {
10 bench('Spread', () => {
11 return { ...object }
12 })
13 bench('Object assign', () => {
14 return Object.assign({}, object)
15 })
16 bench('lodash clone', () => {
17 _.clone(object)
18 })
19 bench('rambda assoc', () => {
20 assoc(object)
21 })
22 })
23
24 await run({
25 units: true,
26 })