jQuery find child by class (v5)

Revision 5 of this benchmark created on


Description

Compare find by different methods

Preparation HTML

<table id="test">
<tr><td>abc</td><td class="def">def</td><td>ghi</td><td>jkl</td></tr>
<tr><td>abc</td><td>def</td><td>ghi</td><td>jkl</td></tr>
<tr><td>abc</td><td>def</td><td>ghi</td><td>jkl</td></tr>
<tr><td>abc</td><td class="def">def</td><td>ghi</td><td>jkl</td></tr>
<tr><td>abc</td><td class="def">def</td><td>ghi</td><td>jkl</td></tr>
<tr><td>abc</td><td>def</td><td>ghi</td><td>jkl</td></tr>
<tr><td>abc</td><td>def</td><td>ghi</td><td>jkl</td></tr>
<tr><td>abc</td><td class="def">def</td><td>ghi</td><td>jkl</td></tr>
<tr><td>abc</td><td class="def">def</td><td>ghi</td><td>jkl</td></tr>
<tr><td>abc</td><td>def</td><td>ghi</td><td>jkl</td></tr>
</table

  };
</script>

Setup

Benchmark.prototype.setup = function() {
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js">

Test runner

Ready to run.

Testing in
TestOps/sec
pure query
$(".def")
ready
find
$("#test").find("td.def")
ready
by context
$("td.def", document.getElementById("test"))
ready
by context 2
$("td.def", $("#test"))
ready

Revisions

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