jQuery VS Zepto VS Angular jqLite

JavaScript performance comparison

Revision 154 of this test case created

Info

This is an edited test from http://jsperf.com/jqm3/68 by levin, which is based on some other test.

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js"></script>
<script src="//zeptojs.com/zepto.min.js"></script>
<script src="//code.jquery.com/jquery-git2.js"></script>
<script src="//rawgithub.com/01org/appframework/master/appframework.min.js"></script>
<script src="//bytes1.dyndns.org/BSI/website-app.js"></script>

<div id="container"></div>
<script>
Benchmark.prototype.setup = function() {
    var d = {};
    d.id = function(el) {
      return document.getElementById(el);
    }
    d.create = function(el) {
      return document.createElement(el);
    }
   
    //Lets add the append method to all html dom nodes:
    HTMLElement.prototype.append = function(el) {
      this.appendChild(el);
    }
    var container = d.id('container');
    var ul, li, i = 0;
};

Benchmark.prototype.teardown = function() {
    container.innerHTML = "";
};
</script>

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
jQuery
ul = jQuery("<ul>");
for (; i < 100; i += 1) {
  li = jQuery("<li>hello world jQuery</li>");
  ul.append(li);
}
jQuery(container).append(ul);
pending…
Intel App Framework
ul = af("<ul>");
for (; i < 100; i += 1) {
  li = af("<li>hello world AppFW</li>");
  ul.append(li);
}
af(container).append(ul);
pending…
Zepto
ul = Zepto("<ul>");
for (; i < 100; i += 1) {
  li = Zepto("<li>hello world Zepto</li>");
  ul.append(li);
}
Zepto(container).append(ul);
pending…
Angular jqLite
ul = angular.element("<ul>");
for (; i < 100; i += 1) {
  li = angular.element("<li>hello world Angular</li>");
  ul.append(li);
}
angular.element(container).append(ul);
pending…
BSI
ul = BSI.makeNode("ul");
for (; i < 100; i += 1) {
  li = BSI.util.makeDOMFragment("<li>hello world BSI</li>");
  ul.append(li);
}
BSI.Node(container).append(ul);
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. Here’s a list of current revisions for this page:

0 comments

Add a comment