Template, Mustache.js, Hogan.js, Templayed.js and Mote.js comparison

JavaScript performance comparison

Revision 6 of this test case created by Rolf

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 src="https://raw.github.com/satchmorun/mote/master/mote.js"></script>
<script>
Benchmark.prototype.setup = function() {
     var template = new Template();
      var tmpl = '{repeat:mustache} {name}{.}{/repeat:mustache}',
        render = template.compile(tmpl),
        data = {mustache: [1, 2, 3, 4]},
        compiled = Hogan.compile("{{#mustache}} {{name}}{{.}}{{/mustache}}"),
        tpl= templayed("{{#mustache}} {{name}}{{.}}{{/mustache}}"),
    motejs = mote.compile('{{#mustache}} {{name}}{{.}}{{/mustache}}');
       
       
};
</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("{{#mustache}} {{name}}{{.}}{{/mustache}}", data)
pending…
Hogan
compiled.render(data)
pending…
precompiled Template
render(data)
pending…
Template
template.substitute(tmpl, data)
pending…
Templayed
tpl(data)
pending…
Mote.js
motejs(data);
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