zepto vs jquery - selectors

JavaScript performance comparison

Revision 105 of this test case created by Norbert Varga

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.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>
    

Preparation code output

<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>

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
Zepto ID
Zepto('#chapter_004')
pending…
jQuery ID
jQuery('#chapter_004')
pending…
Zepto ClassName
Zepto('.view')
pending…
jQuery ClassName
jQuery('.view')
pending…
jquery
jQuery('#chapter_004 .content')
pending…
Zepto
Zepto('#chapter_004 .content')
pending…
id querySelector
document.querySelector('#chapter_004')
pending…
class querySelector
document.querySelector('.view')
pending…
class querySelectorAll
document.querySelectorAll('.view')
pending…
getElementById
document.getElementById('chapter_004')
pending…
getElementsByClassName
document.getElementsByClassName('view')
pending…
jQuery wrap querySelector
jQuery(document.querySelector('#chapter_004'))
pending…
jQuery wrap querySelectorAll
jQuery(document.querySelectorAll('.view'))
pending…
jQuery wrap getElementById
jQuery(document.getElementById('chapter_004'))
pending…
vanilla combined
document.getElementById('chapter_004').getElementsByClassName('view')
pending…
jQuery wrap vanilla combined
jQuery(document.getElementById('chapter_004').getElementsByClassName('view'))
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