jQ.Mobi VS zepto

JavaScript performance comparison

Revision 79 of this test case created by

Preparation code

<script src="https://zeptojs.com/zepto.min.js">
</script>
<script src="https://cdn.jqmobi.com/jq.mobi.min.js">
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.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

<script src="https://cdn.jqmobi.com/jq.mobi.min.js"> </script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"> </script> <div id="container"> </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
jQ.Mobi
ul = jq("<ul/>");
for (; i < 100; i += 1) {
  li = jq("<li>hello world jq.Mobi</li>");
  ul.append(li);
}
jq(d.id('container')).append(ul);
pending…
jQuery
ul = jQuery("<ul/>");
for (; i < 100; i += 1) {
  li = jQuery("<li>hello world jQuery</li>");
  ul.append(li);
}
jQuery(d.id('container')).append(ul);
pending…
Zepto
ul = Zepto("<ul/>");
for (; i < 100; i += 1) {
  li = Zepto("<li>hello world Zepto</li>");
  Zepto(ul).append(li);
}
Zepto(d.id('container')).append(ul);
pending…
Raw JS - Building DOM nodes
i, ul = document.createElement("ul");
for (; i < 100; i += 1) {
  li = document.createElement("li");
  li.innerText = 'hello world raw JS';
  ul.appendChild(li);
}
document.getElementById("container").appendChild(ul);
pending…
some jQuery style, native performance with prototypes
ul = d.create("ul");
for (; i < 100; i += 1) {
  li = d.create("li");
  li.innerText = 'hello world almost raw JS';
  ul.append(li);
}
jq("#container")[0].append(ul);
pending…
jq.mobi
ul = jq("<ul/>");
var html = "";
for (; i < 100; i += 1) {
  html += "<li>hello world jq.Mobi</li>";
}
ul.html(html);
jq(d.id('container')).append(ul);
pending…
jq.mobi 2
ul = jq("<ul/>");
var html = [];
for (; i < 100; i += 1) {
  html.push("<li>hello world jq.Mobi</li>");
}
ul.html(html);
jq(d.id('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.

0 Comments