jquery.merge vs push apply

JavaScript performance comparison

Revision 2 of this test case created by

Preparation code

<script src="https://code.jquery.com/jquery-2.0.0.min.js"></script>
      
<script>
Benchmark.prototype.setup = function() {
  var ret = [];
  var $ = window.$;
  var elems = document.getElementsByTagName('div');
  var core_push = Array.prototype.push;

};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
$.merge
ret.length = 0;
$.merge(ret, elems);
pending…
core_push.apply
ret.length = 0;
core_push.apply(ret, elems);
pending…

Compare results of other browsers

Revisions

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

0 Comments