From: Jérôme Benoit Date: Fri, 23 Dec 2022 17:09:02 +0000 (+0100) Subject: Add just-clone to cloning benchmark X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=a9aa1456a06c073747e52d827129f5f2545200e8;p=benchmarks-js.git Add just-clone to cloning benchmark Signed-off-by: Jérôme Benoit --- diff --git a/clone-object.js b/clone-object.js index 671e8c0..73619f2 100644 --- a/clone-object.js +++ b/clone-object.js @@ -2,6 +2,7 @@ const Benchmark = require('benny') const { generateRandomInteger } = require('./benchmark-utils') const _ = require('lodash') +const clone = require('just-clone') const size = generateRandomInteger(500) const testObject = {} @@ -29,6 +30,9 @@ Benchmark.suite( Benchmark.add('lodash deep clone', (obj = testObject) => { const objClone = _.cloneDeep(obj) }), + Benchmark.add('just-clone', (obj = testObject) => { + const objClone = clone(obj) + }), Benchmark.cycle(), Benchmark.complete(), Benchmark.save({ diff --git a/package-lock.json b/package-lock.json index ead711f..cee2b93 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "license": "MIT", "dependencies": { "benny": "^3.7.1", + "just-clone": "^6.2.0", "lodash": "^4.17.21", "microtime": "^3.1.1", "uuid": "^9.0.0" @@ -2045,6 +2046,11 @@ "node": ">=4.0" } }, + "node_modules/just-clone": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/just-clone/-/just-clone-6.2.0.tgz", + "integrity": "sha512-1IynUYEc/HAwxhi3WDpIpxJbZpMCvvrrmZVqvj9EhpvbH8lls7HhdhiByjL7DkAaWlLIzpC0Xc/VPvy/UxLNjA==" + }, "node_modules/kleur": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", diff --git a/package.json b/package.json index 19fe39c..ffccc57 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "license": "MIT", "dependencies": { "benny": "^3.7.1", + "just-clone": "^6.2.0", "lodash": "^4.17.21", "microtime": "^3.1.1", "uuid": "^9.0.0"