zepto vs jquery vs d3 - selectors (v70)

Revision 70 of this benchmark created on


Preparation HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.1.4/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.11/d3.min.js"></script>

<div id="rsvp" class="view" data-view-title="RSVPs">
    <div class="content"></div>
</div>
<div id="chapter_001" class="view" data-view-title="Splendid Corgi 
Consortium">
    <div class="content"></div>
</div>
<div id="chapter_002" class="view" data-view-title="Splendid Corgi Consortium">
    <div class="content"></div>
</div>
<div id="chapter_003" class="view" data-view-title="Splendid Corgi Consortium">
    <div class="content"></div>
</div>
<div id="chapter_004" class="view" data-view-title="Splendid Corgi Consortium">
    <div class="content"></div>
</div>
<div id="chapter_005" class="view" data-view-title="Splendid Corgi Consortium">
    <div class="content"></div>
</div>
<div id="chapter_006" class="view" data-view-title="Splendid Corgi Consortium">
    <div class="content"></div>
</div>

Setup

function id(id) {
      return document.getElementById(id);
    }

Test runner

Ready to run.

Testing in
TestOps/sec
Zepto ID
Zepto('#chapter_004')
ready
jQuery ID
jQuery('#chapter_004')
ready
querySelector
document.querySelector('#chapter_004')
ready
querySelectorAll
document.querySelectorAll('#chapter_004')
ready
getElementById
document.getElementById('chapter_004')
ready
jQuery(getElementById)
jQuery(document.getElementById('chapter_004'))
ready
jQuery(function)
jQuery(id('chapter_004'))
ready
d3 select
d3.select("#chapter_004")
ready
d3 selectAll
d3.selectAll("#chapter_004")
ready
d3 select by element
d3.select(document.getElementById('chapter_004'))
ready

Revisions

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