id vs class vs adjacent selector

Benchmark created by scott on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div>
    <span>first span</span>
    <span class="select" id="select">second span</span>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
id selector
var select = $('#select');
ready
class selector
var select = $('.select');
ready
adjacent selector
var select = $('span+span');
ready

Revisions

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

  • Revision 1: published by scott on