DOM vs innerHTML based Templating

JavaScript performance comparison

Revision 715 of this test case created by Roman

Info

A brief comparison of some JavaScript templating engines on a short template: 7 DOM nodes ... 7 interpolated values.

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

Test runner

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

Java applet disabled.

Testing in unknown unknown
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. Here’s a list of current revisions for this page:

0 comments

Add a comment