jquery-id-selector-performance-thingy

Benchmark created by Kyle on


Preparation HTML

<div id="content">
    <div class="hello"><p>Hello world</p></div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Setup

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

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery('#id')
jQuery('#content');
ready
jQuery(document.getElementById('content'))
jQuery(document.getElementById('content'));
ready
jQuery(getEl('content'))
jQuery(byId('content'));
ready

Revisions

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