JavaScript performance comparison

Test case created by Joshua Cody and last updated


Determine whether or not prefacing a class-name with an element name achieves any performance boost with jQuery selectors.

Hypothesis: like in CSS, adding an element name to the class name will not provide any performance boost, because selectors are evaluated right-to-left. Also, pseudo-selectors are slow.

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div class="visible">

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
Selector Plus Class
Class Only
Pseudo Class

Compare results of other browsers


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:

1 comment

Comment form temporarily disabled.

Add a comment