DOM vs innerHTML based Templating

JavaScript performance comparison

Revision 715 of this test case created by Roman

Preparation code

<script src = "https://raw.github.com/pasaran/yate/master/lib/runtime.js" >
</script>
<script src = "https://github.com/pasaran/yate/blob/master/tests/arrays.01.yate" >
</script>
<script>
  yr.register("test", "<ul>\nfor .items.item {\n  <li>{ .title }\n</li>\n  }\n</ul>");

  var list = [], item;
  for (var i = 0; i < 10000; i++) {
    item = {};
    for (var j = 0; j < 15; j++) {
      item[i] = i;
    }
    list.push(item)
  }
</script>
    

Preparation code output

<script src = "https://github.com/pasaran/yate/blob/master/tests/arrays.01.yate" > </script> <script> yr.register("test", "<ul>\nfor .items.item {\n <li>{ .title }\n</li>\n }\n</ul>"); var list = [], item; for (var i = 0; i < 10000; i++) { item = {}; for (var j = 0; j < 15; j++) { item[i] = i; } list.push(item) } </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
Yate Template
yr.run('test', list);
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