jquery.merge vs push apply

Benchmark created by Rick Waldron on


Preparation HTML

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

Setup

var push = [].push;
    
    function merge( dest, source ) {
      push.apply( dest, source );
      return dest;
    }

Test runner

Ready to run.

Testing in
TestOps/sec
jquery.merge
jQuery.merge([], [1,2,4,5,6,7,8,9,10,11,12,13,14,15]);
ready
merge w/ push apply
merge([], [1,2,4,5,6,7,8,9,10,11,12,13,14,15]);
ready

Revisions

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