master:
uzlopak@Battlestation:~/workspace/deepmerge$ node benchmark.js
merge existing simple keys in target at the roots x 1,532,019 ops/sec ±1.78% (83 runs sampled)
merge nested objects into target x 28,632 ops/sec ±1.05% (76 runs sampled)
this branch:
uzlopak@Battlestation:~/workspace/deepmerge$ node benchmark.js
merge existing simple keys in target at the roots x 1,540,510 ops/sec ±1.36% (87 runs sampled)
merge nested objects into target x 838,991 ops/sec ±1.35% (84 runs sampled)
corresponding benchmark:
var Benchmark = require('benchmark');
var merge = require('.');
var suite = new Benchmark.Suite;
var srcSimple = { key1: 'changed', key2: 'value2' }
var targetSimple = { key1: 'value1', key3: 'value3' }
var srcNested = {
key1: {
subkey1: 'subvalue1',
subkey2: 'subvalue2',
},
}
var targetNested = {
key1: 'value1',
key2: 'value2',
}
// add tests
suite.add('merge existing simple keys in target at the roots', function() {
var res = merge(targetSimple, srcSimple)
})
suite.add('merge nested objects into target', function() {
var res = merge(targetNested, srcNested)
})
// add listeners
.on('cycle', function(event) {
console.log(String(event.target));
})
// run async
.run({ 'async': true });
master: uzlopak@Battlestation:~/workspace/deepmerge$ node benchmark.js merge existing simple keys in target at the roots x 1,532,019 ops/sec ±1.78% (83 runs sampled) merge nested objects into target x 28,632 ops/sec ±1.05% (76 runs sampled)
this branch: uzlopak@Battlestation:~/workspace/deepmerge$ node benchmark.js merge existing simple keys in target at the roots x 1,540,510 ops/sec ±1.36% (87 runs sampled) merge nested objects into target x 838,991 ops/sec ±1.35% (84 runs sampled)
corresponding benchmark: