JQuery Wrapper Performance

JavaScript performance comparison

Test case created by Sunny

Preparation code

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

<body>  
  <p>The queue length is: <span></span></p>
</body>
<script>
Benchmark.prototype.setup = function() {
    var bLeft = true;
    var d = $("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
function updateFunctions() {
  if(bLeft) {
    $("div").css("left","+=20px");
  } else {
    $("div").css("left","-=20px");
  }
  bLeft = !bLeft;
  // if(!bStop)
  //   setTimeout(updateFunctions,0);
}
pending…
jQuery-No-Selector
function updateFunctions() {
  if(bLeft) {
    d.css("left","+=20px");
  } else {
    d.css("left","-=20px");
  }
  bLeft = !bLeft;
  // if(!bStop)
  //   setTimeout(updateFunctions,0);
}
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