Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36
Chrome 86
Linux
Desktop
3 years ago
Test name Executions per second
lodash merge 2977265.8 Ops/sec
object.assign 5532294.5 Ops/sec
spread 1789600.2 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>
Tests:
  • lodash merge

     
    var a = { a: 'oh', b: 'my' };
    var b = { c: 'goddess' };
    var c = _.merge(a, b);
  • object.assign

     
    var a = { a: 'oh', b: 'my' };
    var b = { c: 'goddess' };
    var c = Object.assign(a, b);
  • spread

     
    var a = { a: 'oh', b: 'my' };
    var b = { c: 'goddess' };
    var c = { ...a, ...b };