jquery children vs find

JavaScript performance comparison

Test case created by heeju

Preparation code

<ul id="lists">
  <li class="item">
    item1
  </li>
  <li class="item">
    item2
  </li>
  <li class="item">
    item3
  </li>
  <li class="item">
    item4
  </li>
  <li class="item">
    item5
  </li>
</ul>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>

Preparation code output

  • item1
  • item2
  • item3
  • item4
  • item5

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
find
$('#lists').find('li');
pending…
find with class selector
$('#lists').find('.item');
pending…
children with selector
$('#lists').children();
pending…
children with selector
$('#lists').children('.item');
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