Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
Chrome 68
Windows
Desktop
6 years ago
Test name Executions per second
Array.prototype.concat 5390275.5 Ops/sec
spread operator 21683872.0 Ops/sec
Lodash merge 353159.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>
Tests:
  • Array.prototype.concat

     
    var params = [ "hello", true, 7 ];
    var other = [1,2].concat(params);
  • spread operator

     
    var params = [ "hello", true, 7 ]
    var other = [ ...[1, 2], ...params ]
  • Lodash merge

     
    var params = [ "hello", true, 7 ];
    var other = _.merge([], [1, 2], params);