Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.92 Safari/537.36
Chrome 69
Mac OS X 10.13.6
Desktop
6 years ago
Test name Executions per second
lodash merge 389437.0 Ops/sec
object.assign 1851754.0 Ops/sec
spread 799843.9 Ops/sec
HTML Preparation code:
x
 
1
2
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
 
var a = { a: 'oh', b: 'my' };
var b = { c: 'goddess', d: 'a', e: 'b', j: { asd: 'test' } };
Tests:
  • lodash merge

     
    var c = _.merge({}, a, b);
  • object.assign

     
    var c = Object.assign({}, a, b);
  • spread

     
    var c = { ...a, ...b };