jQuery vs JavaScript Performance Comparison (v11)

Revision 11 of this benchmark created on


Preparation HTML

<div id="hello" data-id="hello">
</div>
<div class="bye" data-class="bye">
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
JavaScript ID Selector
var $el = document.getElementById('hello');
ready
JavaScript Class Selector
var $el = document.getElementsByClassName('bye');
ready
JavaScript querySelectorAll Selector
var $el = document.querySelectorAll('[data-id="hello"]');
ready
JavaScript Query Selector
var $el = document.querySelector('[data-id="hello"]');
ready
JavaScript Query Selector CLASS
var $el = document.querySelector('.bye');
ready

Revisions

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