some jquery selectors performance tests

JavaScript performance comparison

Revision 28 of this test case created

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

<div>
<div>
<ul id="list">
<li class="item" id="opt1">
<a id="btn1" class="trk"></a>
</li>
<li class="item" id="opt2">
<a id="btn2" class="trk"></a>
</li>
<li class="item" id="opt3">
<a id="btn3" class="trk"></a>
</li>
<li class="item" id="opt4">
<a id="btn4" class="trk"></a>
</li>
</ul>
</div>
</div>

<script>
  //$a = $('#a');
</script>

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
$('#opt1 a, #opt2 a, #opt3 a, #opt4 a')
$('#opt1 a, #opt2 a, #opt3 a, #opt4 a')
pending…
$('.trk')
$('.trk') 
 
pending…
$('#btn1, #btn2, #btn3, #btn4')
$('#btn1, #btn2, #btn3, #btn4') 
pending…
$('#opt2 a')
$('#opt2 a') 
pending…
$('.item a')
$('.item a') 
pending…
$('#list li a')
$('#list li a') 
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