querySelector vs jq selector

Benchmark created on


Description

To test if wrapping document.querySelector is faster then passing the selector to jquery as normal.

Preparation HTML

<article class="something"></article>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
$(querySelector)
$(document.querySelector('article.something'));
ready
$('selector')
$('article.something');
ready
$('selector').find('something')
$('article').find('.something);
ready

Revisions

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