Test name | Executions per second |
---|---|
Mustache Unparsed | 272939.7 Ops/sec |
Mustache Parsed | 279923.5 Ops/sec |
<script src="https://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v4.0.5.js"></script>
<script src="https://twitter.github.io/hogan.js/builds/3.0.1/hogan-3.0.1.js"></script>
<script src="https://rawgit.com/janl/mustache.js/v2.2.1/mustache.js"></script>
<script src="https://rawgit.com/satchmorun/mote/master/mote.js"></script>
var templateParsed = "<strong>This is a slightly more complicated {{thing}}.</strong>.\n{{! Just ignore this business. }}\nCheck this out:\n{{#hasThings}}\n<ul>\n{{#things}}\n<li class={{className}}>{{word}}</li>\n{{/things}}</ul>.\n{{/hasThings}}\n{{^hasThings}}\n\n<small>Nothing to check out...</small>\n{{/hasThings}}";
var templateUnparsed = "<strong>This is a slightly more complicated {{thing}}.</strong>.\n{{! Just ignore this business. }}\nCheck this out:\n{{#hasThings}}\n<ul>\n{{#things}}\n<li class={{className}}>{{word}}</li>\n{{/things}}</ul>.\n{{/hasThings}}\n{{^hasThings}}\n\n<small>Nothing to check out...</small>\n{{/hasThings}}";
var context = {
thing: function() {
return "blah";
},
things: [
{"className": "one", word: "@fat"},
{"className": "two", word: "@dhg"},
{"className": "three", word:"@sayrer"}
],
hasThings: true
};
Mustache.parse(templateParsed);
Mustache.render(templateUnparsed, context);
Mustache.render(templateParsed, context);