Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0
Firefox 79
Windows
Desktop
4 years ago
Test name Executions per second
Array.prototype.concat 2990.7 Ops/sec
spread operator 2668.6 Ops/sec
Lodash merge 213.4 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 array1 = (new Array(10000)).fill(Math.random(), 0, 9999);
var array2 = (new Array(10000)).fill(Math.random(), 0, 9999);
Tests:
  • Array.prototype.concat

     
    var other = array1.concat(array2);
  • spread operator

     
    var other = [ ...array1, ...array2 ]
  • Lodash merge

     
    var other = _.merge([], array1, array2);