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