concat vs push.apply (v17)

Revision 17 of this benchmark created by Krinkle on


Setup

var sampleA = [],
      sampleB = [],
      core_push = Array.prototype.push;
  
  for (var i = 0; i < 42; ++i) {
    sampleA[i] = {};
    sampleB[i] = {};
  }

Test runner

Ready to run.

Testing in
TestOps/sec
concat
sampleA = sampleA.concat(sampleB);
ready
push.apply
sampleA.push.apply(sampleA, sampleB);
ready
Array#push.apply
Array.prototype.push.apply(sampleA, sampleB);
ready
core_push.apply
core_push.apply(sampleA, sampleB);
ready

Revisions

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