Template Hogan.js comparison

JavaScript performance comparison

Revision 3 of this test case created by Thierry Bela

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/mootools/1.4/mootools-yui-compressed.js"></script><script src="https://raw.github.com/tbela99/template/master/Source/Template.js"></script><script src="https://raw.github.com/janl/mustache.js/master/mustache.js"></script><script src="https://raw.github.com/twitter/hogan.js/master/lib/template.js"></script>
<script src="https://raw.github.com/twitter/hogan.js/master/lib/compiler.js"></script>
<script src="https://raw.github.com/archan937/templayed.js/master/src/templayed.js"></script>
<script>
Benchmark.prototype.setup = function() {
      var template = new Template(),
        render = template.compile('{title} spends {calc}');
     
        var view = {
          title: "Joe",
          calc: function() {
            return 2 + 4;
          }
        },
        compiled = Hogan.compile("{{title}} spends {{calc}}"),
      tpl = templayed("{{title}} spends {{calc}}");
       
};
</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
Mustache
Mustache.to_html("{{title}} spends {{calc}}", view)
pending…
Hogan
compiled.render(view)
pending…
precompiled Template
render(view)
pending…
Template
template.substitute('{title} spends {calc}', view)
pending…
Templayed
tpl(view)
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