jQuery Selector Case 1

JavaScript performance comparison

Test case created by Cong Liu

Preparation code

<ul id="list">
  <li>
    Item
  </li>
  <li>
    Item
  </li>
  <li>
    Item
  </li>
  <li>
    Item
  </li>
  <li>
    Item
  </li>
  <li>
    Item
  </li>
  <li>
    Item
  </li>
  <li>
    Item
  </li>
  <li>
    Item
  </li>
  <li>
    Item
  </li>
  <li>
    Item
  </li>
  <li>
    Item
  </li>
  <li>
    Item
  </li>
  <li>
    Item
  </li>
  <li>
    Item
  </li>
  <li>
    Item
  </li>
  <li>
    Item
  </li>
  <li>
    Item
  </li>
  <li>
    Item
  </li>
  <li>
    Item
  </li>
</ul>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.js">
</script>

Preparation code output

  • Item
  • Item
  • Item
  • Item
  • Item
  • Item
  • Item
  • Item
  • Item
  • Item
  • Item
  • Item
  • Item
  • Item
  • Item
  • Item
  • Item
  • Item
  • Item
  • Item

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
$('ul#list li')
$('ul#list li')
pending…
$('ul#list).find('li')
$('ul#list').find('li')
pending…
$('li', '#list')
$('li', '#list')
pending…
$('#list').find('li')
$('#list').find('li')
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