JQuery Wrapper Performance

JavaScript performance comparison

Revision 2 of this test case created by Alexander

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<p>The queue length is: <span></span></p>
 
<script>
Benchmark.prototype.setup = function() {
    var bLeft = true;
    var $div = $("div") ;
};
</script>

Preparation code output

The queue length is:

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
jQuerySelector
if(bLeft) {
  $("div").css("left","+=20px");
} else {
  $("div").css("left","-=20px");
}
bLeft = !bLeft;
 
pending…
jQuery-No-Selector
if(bLeft) {
  $div.css("left","+=20px");
} else {
  $div.css("left","-=20px");
}
bLeft = !bLeft;
 
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