zepto vs jquery - selectors

JavaScript performance comparison

Revision 47 of this test case created

Info

Added native

Preparation code

<script src="//www.cinsoft.net/mylib099-min.js"></script>
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<script src="http://zeptojs.com/zepto.min.js"></script>


<div id="rsvp" class="view" data-view-title="RSVPs">
    <div class="content"></div>
</div>
<div id="chapter_004" class="view" data-view-title="Splendid Corgi Consortium">
    <div class="content"></div>
</div>
<script>
Benchmark.prototype.setup = function() {
    var native = function(e) {
      return document.querySelectorAll(e);
    };
   
    //raw document.getElementById(id) is slightly faster
    native.prototype.id = function(id) {
      return document.getElementById(id);
    };
};
</script>

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Zepto ID
Zepto('#chapter_004')
pending…
jQuery2 ID
jQuery('#chapter_004')
pending…
Native querySelectorAll
native('#chapter_004');
pending…
Native getElementById
native.id('chapter_004')
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. Here’s a list of current revisions for this page:

0 comments

Add a comment