jQuery vs JavaScript Performance Comparison (v4)

Revision 4 of this benchmark created on


Description

Attempting to use latest query version to see if there any difference at all.

Preparation HTML

<div id="hello">
</div>
<div class="bye">
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery ID Selector
var $el = $('#hello');
ready
JavaScript ID Selector
var $el = document.querySelector('#hello');
ready
jQuery Class Selector
var $el = $('.bye');
ready
JavaScript Class Selector
var $el = document.querySelector('.bye');
ready
JavaScript getElementById
var $el = document.getElementById('hello');
ready
JavaScript getElementById + jQuery Object
var $el = $(document.getElementById('hello'));
ready

Revisions

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