Javascript array concat vs push (v41)

Revision 41 of this benchmark created on


Description

1) var arr1=[1,2,3]; arr1=arr1.concat([4]);

2) var arr1=[1,2,3]; arr1.push(4);

Test runner

Ready to run.

Testing in
TestOps/sec
concat
for (i = 10000; i > 0; i--) {
  var arr1 = [1,2,3];
  var arr2 = arr1.concat([4]);
}
ready
push
for (i = 10000; i > 0; i--) {
  var arr1 = [1,2,3];
  arr1.push(4);
}
ready

Revisions

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