jQuery Attribute selector performance (v17)

Revision 17 of this benchmark created on


Description

Test to see if jQuery filters by selector before doing attribute matching.

Preparation HTML

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

<b class="t" name="test0"></b>
<b class="t" name="test0"></b>
<b class="t" name="test0"></b>
<b class="t" name="test1"></b>
<b class="t" name="test1"></b>
<b class="t" name="test1"></b>

Test runner

Ready to run.

Testing in
TestOps/sec
Attribute matching only
$('[name$="test0"]');
ready
Attribute matching with class first
$('.t[name$="test0"]');
ready
Chained
$('.t').find('[name$="test0"]');
ready
Attribute start with
$('.t').find('[name^="test"]');
ready
Class and attribute selector
$('.t[name^="test"]');
ready
Only Class
$('.t')
ready

Revisions

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