Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
Chrome 65
Windows
Other
6 years ago
Test name Executions per second
Array.prototype.concat 41337.9 Ops/sec
spread operator 294.6 Ops/sec
Lodash merge 1451.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);