Vanilla vs JQuery

Benchmark created by test on


Preparation HTML

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

<option> 1 </option> 
<option> 2 </option> 
<option> 3 </option> 

</select>

Test runner

Ready to run.

Testing in
TestOps/sec
vanilla
var select = document.getElementById('select'); 

var option = select.children[2]; 
ready
jQuery
var select = document.getElementById('select'); 

var option = $('*:nth-child(' + 2 + ')', select); 
ready
Variation with jQuery
var select = $('#select'); 

var option = select.children()[2]; 
ready
variation 2 with jQuery
var select = $('#select'); 

var option = ('*:nth-child(' + 2 + ')', select); 
ready

Revisions

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