jQuery 1.x vs 2.x

JavaScript performance comparison

Revision 15 of this test case created by

Preparation code

<script src="https://code.jquery.com/jquery-git1.js">
</script>
<script>
  jQ1 = jQuery.noConflict();
</script>
<script src="https://code.jquery.com/jquery-git2.js">
</script>
<script>
  jQ2 = jQuery.noConflict();
</script>
<div id="wrapper">
</div>
      
<script>
Benchmark.prototype.setup = function() {
  jQ2("#wrapper").html('\n\
  <div id="idSelector" style="display: none;">\n\
    <div class="classSelector">\n\
      <div id="find">\n\
        <div id="cssGetter" style="color: black;">\n\
          <div id="cssSetter" style="color: black;">\n\
            <ul id="iteration">\n\
              <li>\n\
                <div id="editablearea">\n\
                </div>\n\
              </li>\n\
              <li>\n\
                <p>\n\
              </li>\n\
              <li>\n\
                <input type="checkbox">\n\
              </li>\n\
              <li>\n\
                <h>\n\
                </h>\n\
              </li>\n\
              <li>\n\
                <table>\n\
                  <thead>\n\
                  </thead>\n\
                  <tbody>\n\
                  </tbody>\n\
                </table>\n\
              </li>\n\
              <li>\n\
                <textarea>\n\
                </textarea>\n\
              </li>\n\
              <li>\n\
                <span>\n\
                </span>\n\
              </li>\n\
            </ul>\n\
          </div>\n\
        </div>\n\
        <div>\n\
        </div>\n\
      </div>\n\
    </div>\n\
  </div>\n\
  ');
  
  function testcase(_$) {
    _$(".classSelector").data('ts', '3').attr('test', 'test');
  };

};

Benchmark.prototype.teardown = function() {
  jQ2("#wrapper").empty();

};
</script>

Preparation code output

<script> jQ1 = jQuery.noConflict(); </script> <script src="https://code.jquery.com/jquery-git2.js"> </script> <script> jQ2 = jQuery.noConflict(); </script> <div id="wrapper"> </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.x
testcase(jQ1);
pending…
2.x
testcase(jQ2);
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