Context vs Find

Benchmark created on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="foo">
<a class="button"></a>
<a class="button"></a>
<a class="button"></a>
<a class="button"></a>
</div>
<a class="button"></a>
<a class="button"></a>
<a class="button"></a>
<a class="button"></a>

Setup

var $foo = $("#foo");

Test runner

Ready to run.

Testing in
TestOps/sec
Context
$("a.button", $foo);
ready
Find
$foo.find("a.button");
ready

Revisions

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