X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=deep-clone-object.mjs;h=8206cd9948a0997160f7986193939d74ca001e7a;hb=f364a19a8cf80e8d817f817342bc71a743b79e09;hp=52a1bac29a382a19d6a9c2a060400797d2795a04;hpb=f522d7b906f8a45a7e4fd349abe3f83bf8fc3d69;p=benchmarks-js.git diff --git a/deep-clone-object.mjs b/deep-clone-object.mjs index 52a1bac..8206cd9 100644 --- a/deep-clone-object.mjs +++ b/deep-clone-object.mjs @@ -3,26 +3,26 @@ import Benchmark from 'benny' import _ from 'lodash' import clone from 'just-clone' import deepClone from 'deep-clone' -import { generateRandomObject } from './benchmark-utils.js' +import { generateRandomObject } from './benchmark-utils.mjs' const object = generateRandomObject() Benchmark.suite( `Deep clone object with ${Object.keys(object).length} keys`, Benchmark.add('JSON stringify/parse', (obj = object) => { - const objClone = JSON.parse(JSON.stringify(obj)) + const objCloned = JSON.parse(JSON.stringify(obj)) }), Benchmark.add('structuredClone', (obj = object) => { - const objClone = structuredClone(obj) + const objCloned = structuredClone(obj) }), Benchmark.add('lodash cloneDeep', (obj = object) => { - const objClone = _.cloneDeep(obj) + const objCloned = _.cloneDeep(obj) }), Benchmark.add('just-clone', (obj = object) => { - const objClone = clone(obj) + const objCloned = clone(obj) }), Benchmark.add('deep-clone', (obj = object) => { - const objClone = deepClone(obj) + const objCloned = deepClone(obj) }), Benchmark.cycle(), Benchmark.complete(),