getElementById VS jQuery('#id') (v62)

Revision 62 of this benchmark created on


Preparation HTML

<script src="http://code.jquery.com/jquery-1.8.3.min.js">
</script>
<p id="foo">
  Test
  <div class="inner">
    inner
  </div>
</p>

Test runner

Ready to run.

Testing in
TestOps/sec
getElementById
document.getElementById('foo');
ready
jQuery
$('#foo');
ready
jQuery wrapped getElementById
$(document.getElementById('foo'));
ready
Process dom node
$(document.getElementById('foo')).html(Math.random()*999999);
ready
Process jquery node
$('#foo').html(Math.random()*999999);
ready
Find elements in dom node
$('.inner');
ready
Find elements in jquery node
document.getElementsByClassName('inner');
ready
$(document.getElementsByClassName('inner'))
ready

Revisions

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