Skip to content

Commit

Permalink
chore: update benchmark;
Browse files Browse the repository at this point in the history
- measure load times
  • Loading branch information
lukeed committed Jul 3, 2020
1 parent 0d324fe commit 72a460d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 9 deletions.
41 changes: 33 additions & 8 deletions bench/index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,43 @@
const assert = require('assert');
const { Suite } = require('benchmark');

const naiive = x => JSON.parse(JSON.stringify(x));
console.log('Load times: ');

console.time('fast-clone');
const fastclone = require('fast-clone');
console.timeEnd('fast-clone');

console.time('lodash/clonedeep');
const lodash = require('lodash/clonedeep');
console.timeEnd('lodash/clonedeep');

console.time('rfdc');
const rfdc = require('rfdc');
console.timeEnd('rfdc');

console.time('clone-deep');
const clonedeep = require('clone-deep');
console.timeEnd('clone-deep');

console.time('deep-copy');
const deepcopy = require('deep-copy');
console.timeEnd('deep-copy');

console.time('klona');
const klona = require('klona');
console.timeEnd('klona');

const contenders = {
'JSON.stringify': naiive,
'fast-clone': require('fast-clone'),
'lodash': require('lodash/clonedeep'),
'clone-deep': require('clone-deep'),
'deep-copy': require('deep-copy'),
'klona': require('../dist/klona')
'JSON.stringify': x => JSON.parse(JSON.stringify(x)),
'fast-clone': fastclone,
'lodash': lodash,
'rfdc': rfdc(),
'clone-deep': clonedeep,
'deep-copy': deepcopy,
'klona': klona,
};

console.log('Validation: ');
console.log('\nValidation: ');
Object.keys(contenders).forEach(name => {
const INPUT = require('./input');

Expand Down
5 changes: 4 additions & 1 deletion bench/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"private": true,
"devDependencies": {
"benchmark": "2.1.4",
"clone-deep": "4.0.1",
"deep-copy": "1.4.2",
"deepcopy": "2.0.0",
"fast-clone": "1.5.13",
"lodash": "4.17.15"
"klona": "file:../",
"lodash": "4.17.15",
"rfdc": "1.1.4"
}
}

0 comments on commit 72a460d

Please sign in to comment.