document.getElementById vs jQuery Id Selector

Benchmark created by Matt McDonald on


Description

Quick DOM test

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="foo"></div>
<script>
  var el;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
document.getElementById
el = document.getElementById("foo");
el = $(el);
ready
jQuery
el = $('#foo');
ready

Revisions

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

  • Revision 1: published by Matt McDonald on