jquery v js perf

Benchmark created on


Preparation HTML

<div id="outer" class="some-div">
  <div id="inner" class="some-div">
    <div id="innermost" class="some-div"></div>
  </div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery select by id
$('#outer');
$('#inner');
$('#innermost');
ready
native js select by id
document.getElementById('outer');
document.getElementById('inner');
document.getElementById('innermost');
ready
jquery select by class
$('.some-div');
ready
native js select by class
document.querySelectorAll('.some-div')
ready

Revisions

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