jQUery type Selector vs Native

JavaScript performance comparison

Revision 9 of this test case created by Dan

Preparation code

<div>
<input id="a" value="1">
<label for="a">1</label>
</div>
<div>
<input id="b" value="2">
<label for="b">2</label>
</div>
<div>
<input id="c" value="3">
<label for="c">3</label>
</div>

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

 

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
jQuery type selector
$("input");
pending…
Jquery find
$(document).find("input");
pending…
Native QuerySelectorAll
document.querySelectorAll("input");
pending…
Native getElementsByTagName
document.getElementsByTagName("input")
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment