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

JavaScript performance comparison

Revision 8 of this test case created by Thierry Bela

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.4/mootools-yui-compressed.js"></script><script src="https://rawgithub.com/tbela99/template/master/Source/Template.js"></script><script src="https://rawgithub.com/janl/mustache.js/master/mustache.js"></script><script src="https://rawgithub.com/twitter/hogan.js/master/lib/template.js"></script>
<script src="https://rawgithub.com/twitter/hogan.js/master/lib/compiler.js"></script>
<script src="https://rawgithub.com/archan937/templayed.js/master/src/templayed.js"></script>
<script src="https://rawgithub.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 CCBot 2.0.0 / Other 0.0.0
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.

0 Comments