Javascript array concat vs push (v337)

Revision 337 of this benchmark created by Chris Albrecht on


Setup

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

Test runner

Ready to run.

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

Revisions

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