Javascript array concat vs spread operator (v342)

Revision 342 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
spread operator
arr1 = [...arr1, ...arr2];
ready
push.apply
arr1 = arr1.push(...arr2);
ready

Revisions

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