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

Revision 188 of this benchmark created by dsa on


Preparation HTML

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">
</script>
<p id="foo">
  Test
</p>
<p id="bar">
  bars</p>

Setup

var element = document.getElementById('foo');

Test runner

Ready to run.

Testing in
TestOps/sec
getElementById
var id = element.id
ready
jQuery Selector
var id = element.getAttribute('id')
ready
$ Custom Method
 
ready
jQuery Window Object
 
ready
realgetelementbyid
 
ready
typeof
 
ready

Revisions

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