jQ.Mobi (v37)

Revision 37 of this benchmark created by Devin Rhode on


Preparation HTML

<script src="https://staging-ian.appmobi.com/game/zepto.min.js">
</script>
<script src="https://staging-ian.appmobi.com/game/jq.mobi.min.js">
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<div id="container">
</div>

Setup

var d = document;
  d.id = function(el) {
    return d.getElementById(el);
  }
  HTMLElement.prototype.append = function(el) {
    this.appendChild(el);
  }
  var jp = {}; //jp, jquery style syntax, utilizing prototypes
  jp.create = function(el) {
    return d.createElement(el);
  }

Teardown



            document.getElementById("container").innerHTML = "";
        
  

Test runner

Ready to run.

Testing in
TestOps/sec
jQ.Mobi
var ul = jq("<ul/>");
var i;
for (i = 0; i < 100; i += 1) {
  var li = jq("<li>hello world jq.Mobi</li>");
  ul.append(li);
}
jq("#container").append(ul);
ready
jQuery
var ul = jQuery("<ul/>");
var i;
for (i = 0; i < 100; i += 1) {
  var li = jQuery("<li>hello world jQuery</li>");
  ul.append(li);
}
jQuery("#container").append(ul);
ready
Zepto
var ul = Zepto("<ul/>");
var i;
for (i = 0; i < 100; i += 1) {
  var li = Zepto("<li>hello world Zepto</li>");
  Zepto(ul).append(li);
}
Zepto("#container").append(ul);
ready
Raw JS - Building DOM nodes
var ul = document.createElement("ul");
var i;
for (i = 0; i < 100; i += 1) {
  var li = document.createElement("li");
  li.innerText = 'hello world raw JS';
  ul.appendChild(li);
}
d.id("container").appendChild(ul);
ready
Raw JS - innerHTML style
var ul = "<ul>", i;
for (i = 0; i < 100; i++) {
  var li = "<li>hello world NoFramework</li>";
  ul += li;
}
ul += "</ul>";
d.id("container").innerHTML = ul;
ready
Prototype based jquery idea
var ul = jp.create("ul");
var i;
for (i = 0; i < 100; i += 1) {
  var li = jp.create("li");
  li.innerText = 'hello world raw JS';
  ul.append(li);
}
d.id("container").append(ul);
ready

Revisions

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