jQuery("#id")

JavaScript performance comparison

Revision 11 of this test case created by Jens

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
<script>
  var $1_8_3 = jQuery.noConflict();
</script>
<script src="https://dl.dropbox.com/u/6407061/jQuery/sizzle_optimize/jquery.js">
</script>
<script>
  var $git = jQuery.noConflict();
</script>
<div id="test" class="test">
  <div id="child">
  </div>
</div>
<div class="test">
</div>
<div class="test">
</div>
<div class="test">
</div>
<div class="test">
</div>
<div class="test">
</div>
      
<script>
Benchmark.prototype.setup = function() {
  var $1_8_3test = $1_8_3("#test");
  var $gittest = $git("#test");

};
</script>

Preparation code output

<div id="test" class="test"> <div id="child"> </div> </div> <div class="test"> </div> <div class="test"> </div> <div class="test"> </div> <div class="test"> </div> <div class="test"> </div>

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
1.8.3 id
$1_8_3("#test");
pending…
git id
$git("#test");
pending…
1.8.3 element id
$1_8_3test.find("#child");
pending…
git element id
$gittest.find("#child");
pending…
1.8.3 class
$1_8_3(".test");
pending…
git class
$git(".test");
pending…
document.getElementById()
$git(document.getElementById("test"));
pending…
$1_8_3(document.getElementById("test"));
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.

0 Comments