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

Revision 98 of this benchmark created by Paul S on


Preparation HTML

<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>

</script>
<p id="foo">
  Test
</p>

Test runner

Ready to run.

Testing in
TestOps/sec
getElementById
document.getElementById('foo');
ready
jQuery
$('#foo');
ready
jQuery with getElementById
$(document.getElementById('foo'));
ready
jquery with function call
$($g('foo'));
function $g(x){
return document.getElementById(x);
}
ready

Revisions

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