jQuery vs JavaScript Performance Comparison (v39)

Revision 39 of this benchmark created on


Preparation HTML

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

Setup

var tag;
    (tag = createElement('div')).id = 'hello');
    var tag2;
    (tag2 = createElement('div')).classList.add('bye');
    tag.appendChild(tag2);
    document.body.appendChild(tag);

Test runner

Ready to run.

Testing in
TestOps/sec
JS ID Selector
var $el = document.getElementById('hello');
ready
JS generic Selector
var $el = document.querySelector('#hello');
ready
JS Class Selector
var $el = document.getElementsByClassName('bye');
ready
JS generic Selector
var $el = document.querySelectorAll('.bye');
ready
JS multiselect
var $el = document.querySelectorAll('#hello .bye');
ready

Revisions

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