jQuery find performance

JavaScript performance comparison

Revision 3 of this test case created by Pooja Shah

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<table id="tbl" style="border: solid 1px black">
  <tbody>
    <tr>
      <td>
        1
      </td>
      <td>
        a
      </td>
    </tr>
    <tr>
      <td>
        2
      </td>
      <td>
        b
      </td>
    </tr>
    <tr>
      <td>
        3
      </td>
      <td>
        c
      </td>
    </tr>
  </tbody>
</table>

Preparation code output

1 a
2 b
3 c

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Using find
var result1 = $('#tbl> tbody > tr:last')
pending…
Without find
var Result2 = $('#tbl').find('tr:last');
pending…
with tbody and find
var Result2 = $('#tbl>tbody').find('tr:last');
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment