jquery 1.4.2 vs 1.6.2 (v7)

Revision 7 of this benchmark created by Addy Osmani on


Description

Comparison of performance between jQuery versions

Preparation HTML

<div id="test"> 
        <div class="testlink">
                <a href="#" id="linkone" title="test">test link</a>
        </div> 
        <form id="testform" action=""></form>
        <div class="testmenu">
                <ul>
                        <li class="menuitem itemone">
                                <a href="#" title="item 1">menu item 1</a>
                        </li>
                        <li class="menuitem itemtwo">
                                <a href="#" title="item 2">menu item 2</a>
                        </li>
                        <li class="menuitem itemthree">
                                not clickable item 3
                        </li>
                </ul>
        </div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script> var $jq14 = jQuery.noConflict( true ); </script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script> var $jq16 = jQuery.noConflict( true ); </script>

Test runner

Ready to run.

Testing in
TestOps/sec
1.4 by id
$jq14('#linkone');
ready
1.6 by id
$jq16('#linkone')
ready
1.4 by class
$jq14('.menuitem');
ready
1.6 by class
$jq16('.menuitem');
ready
1.4 descendent tag - class
$jq14('div.testmenu a');
ready
1.6 descendent tag - class
$jq16('div.testmenu a');
ready
1.4 by attr
$jq14('a[title="test"]');
ready
1.6 by attr
$jq16('a[title="test"]');
ready
1.4 with regex
$jq14('a[title*="item"]')
ready
1.6 with regex
$jq16('a[title*="item"]');
ready
1.4 nth-child(even)
$jq14('li:nth-child(even)');
ready
1.6 nth-child(even)
$jq16('li:nth-child(even)');
ready
1.4 form select
$jq14('form);
ready
1.6 form select
$jq16('form');
ready
1.4 unquoted attr with simpler regex
$jq14('div[class^=test]');
ready
1.6 unquoted attr with simpler regex
$jq16('div[class^=test]');
ready
1.4 unquoted attr check
$jq14('div[title=test]');
ready
1.6 unquoted attr check
$jq16('div[title=test]');
ready
1.4 tagged-Id
$jq14('div#test');
ready
1.6 taggedId
$jq16('div#test');
ready
1.4 generic descendant
$jq14('body div');
ready
1.6 generic descendant
$jq16('body div');
ready
1.4 multiple
$jq14('div, li, a');
ready
1.6 multiple
$jq16('div, li, a');
ready

Revisions

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