jQuery 1.4.2 vs jQuery 1.8.2 vs jQuery 1.7.2 comparisons (v33)

Revision 33 of this benchmark created by Erick chen on


Description

Checking selector performance in different jQuery versions.

Preparation HTML

<script src="//code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
var $172 = jQuery.noConflict();
</script>

<script src="//code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript">
var $182 = jQuery.noConflict();
</script>

<script src="//code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
var $142 = jQuery.noConflict();
</script>

<style type="text/css">
    .content {
        padding: 0px 10px;
        margin: 0px 5px;
        border: 1px solid orange;
    }
</style>

<div class="wrapper">
     <div class="innerWrapper">
          <div class="button">
               <a href="" id="button" class="buttonRef">
                    <span class="buttonText">Text</span>
               </a>
          </div>
     </div>
 
</div>

<script>
  var context72 = $172("div.wrapper");
  var context82 = $182("div.wrapper");
  var context42 = $142("div.wrapper");
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
$142(".class")
var item = $142(".buttonRef");
ready
$182(".class")
var item = $182(".buttonRef");
ready
$172(".class")
var item = $172(".buttonRef");
ready
$142("#id")
var item = $142("#button");
ready
$182("#id")
var item = $182("#button");
ready
$172("#id")
var item = $172("#button");
ready
Find - Class 1.4.2
var item = context42.find(".buttonRef")
ready
Find - Class 1.8.2
var item = context82.find(".buttonRef")
ready
Find - Class 1.7.2
var item = context72.find(".buttonRef")
ready
width - Clas 1.4.2
width = $142(".content").width();
ready
width - Clas 1.8.2
width = $182(".content").width();
ready
width - Clas 1.7.2
width = $172(".content").width();
ready

Revisions

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