Javascript array concat vs spread operator (v341)

Revision 341 of this benchmark created by Chris Albrecht on


Setup

var arr1 = Array.from(Array(1000), (x,i) => i + 1)
  var arr2 = Array.from(Array(500), (x,i) => i - 1)

Test runner

Ready to run.

Testing in
TestOps/sec
push.apply
Array.prototype.push.apply(arr1, arr2);
ready
spread operator
arr1 = [...arr1, ...arr2];
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.