Template, Mustache.js, Hogan.js and Templayed comparison
JavaScript performance comparison
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.
| Test | Ops/sec | |
|---|---|---|
Mustache |
|
pending… |
Hogan |
|
pending… |
precompiled Template |
|
pending… |
Template |
|
pending… |
Templayed |
|
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:
- Revision 1: published by Thierry Bela
- Revision 2: published
- Revision 3: published by Thierry Bela
- Revision 4: published
- Revision 5: published by Thierry Bela
- Revision 6: published by Rolf
- Revision 7: published by Thierry Bela
- Revision 8: published by Thierry Bela
0 comments