Juqery vs queryselectorall

JavaScript performance comparison

Test case created by reza

Preparation code

<script src="http://code.jquery.com/jquery-1.8.1.min.js"></script>
<script type="text/javascript" src="//raw.githubusercontent.com/jquery/sizzle/master/dist/sizzle.min.js"></script>

<div id='data'>
 <table style="width:100%">
  <tr>
    <td class="gonzalez">gonzalez</td>
    <td>50</td>
  </tr>
  <tr>
    <td>Eve</td>
    <td>94</td>
  </tr>
</table> 
</div>

<div id='data-2'>
 <table style="width:100%">
  <tr>
    <td class="gonzalez">gonzalez</td>
    <td>50</td>
  </tr>
  <tr>
    <td>Eve</td>
    <td>94</td>
  </tr>
</table> 
</div>
    

Preparation code output

<div id='data'> <table style="width:100%"> <tr> <td class="gonzalez">gonzalez</td> <td>50</td> </tr> <tr> <td>Eve</td> <td>94</td> </tr> </table> </div> <div id='data-2'> <table style="width:100%"> <tr> <td class="gonzalez">gonzalez</td> <td>50</td> </tr> <tr> <td>Eve</td> <td>94</td> </tr> </table> </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
querySelectorAll -Optimized
// Optimized
document.querySelectorAll(".data td.gonzalez");
pending…
querySelectorAll -Unoptimized
// Unoptimized
document.querySelectorAll("div.data .gonzalez");
pending…
jQuery with .querySelectorAll disabled -Optimized
document.querySelectorAll = null;

// Optimized
$(".data td.gonzalez");
pending…
jQuery with .querySelectorAll disabled -Unoptimized
document.querySelectorAll = null;

// Unoptimized
$("div.data .gonzalez");
pending…
Sizzle - Optimized
// Optimized
Sizzle(".data td.gonzalez");
pending…
Sizzle - Unoptimized
// Unoptimized
Sizzle("div.data .gonzalez");
pending…

You can edit these tests or add even more tests to this page by appending /edit to the URL.

Compare results of other browsers

0 Comments

gonzalez 50
Eve 94
gonzalez 50
Eve 94