concat vs push.apply (v18)

Revision 18 of this benchmark created by 54yuri on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

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
$.extend
$.extend(sampleA, sampleB);
ready

Revisions

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