Moooo

JavaScript performance comparison

Revision 579 of this test case created by

Preparation code

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mithril/0.1.12/mithril.min.js"></script>
<script src="http://dominate.js.zkpq.ca/dominate.min.js">
</script>


<!-- Mithril -->
<div id="mithrilapp">
  Mithril: <span id="mithrilMountNode"></span>
</div>

<!-- dominate.js -->
Dominate:
<div id="dominate">
</div>

Vanilla:
<div id="vanilla"></div>


<script>
var MithrilData = new Array();
var mithapp = {
  controller: function() {
    this.data = MithrilData;
  },
  view: function(ctrl) {
    return m("span", [ctrl.data.map(function(datum) { return m('span', datum); })]);
  }
}

$(document).ready(function() {

  m.module(document.getElementById("mithrilMountNode"), mithapp);
  window.Mclear = function() {
    m.startComputation();
    MithrilData.splice(0);
    m.endComputation();
  };

  window.Mpush = function(data) {
    m.startComputation();
    MithrilData.push(data);
    m.endComputation();
  }
  

 

var dom_node = one("#dominate");
window.DomClear = function() {
   dom_node.empty();
}
window.DomPush = function(data) {
   dom_node.span(data);
}
  
});
</script>

    

Preparation code output

<script src="https://cdnjs.cloudflare.com/ajax/libs/mithril/0.1.12/mithril.min.js"></script> <script src="http://dominate.js.zkpq.ca/dominate.min.js"> </script> <!-- Mithril --> <div id="mithrilapp"> Mithril: <span id="mithrilMountNode"></span> </div> <!-- dominate.js --> Dominate: <div id="dominate"> </div> Vanilla: <div id="vanilla"></div> <script> var MithrilData = new Array(); var mithapp = { controller: function() { this.data = MithrilData; }, view: function(ctrl) { return m("span", [ctrl.data.map(function(datum) { return m('span', datum); })]); } } $(document).ready(function() { m.module(document.getElementById("mithrilMountNode"), mithapp); window.Mclear = function() { m.startComputation(); MithrilData.splice(0); m.endComputation(); }; window.Mpush = function(data) { m.startComputation(); MithrilData.push(data); m.endComputation(); } var dom_node = one("#dominate"); window.DomClear = function() { dom_node.empty(); } window.DomPush = function(data) { dom_node.span(data); } }); </script>

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
VanillaJS
var vd = document.getElementById("vanilla");
var df = document.createDocumentFragment();
vd.innerHTML = "";
for (var i=0; i<100; i++) {
   var sn = document.createElement("span");
   sn.appendChild(document.createTextNode("vnode"));
   df.appendChild(sn);
}
vd.appendChild(df);
pending…
Mithril 100
Mclear();
for (var i = 0; i < 100; i++)
  Mpush("mitem");
pending…
Dominate 100
one("#dominate").empty();
var d = one(div());
for (var i = 0; i < 100; i++) {
  d.span("ditem");
}
one("#dominate").update(d);
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

Mithril:
Dominate:
Vanilla: