$(document.getElementById) + find("el") VS $('#' + id + " el") (v22)

Revision 22 of this benchmark created by ariel on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>
<p id="foo">
  Test
<a href="#">link</a>
</p>

Setup

var id="foo";

Test runner

Ready to run.

Testing in
TestOps/sec
test1
$(document.getElementById(id)).find("a");
ready
Test2
$('#' + id + ' a');
ready

Revisions

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