t-bench2 (v11)

Revision 11 of this benchmark created by Mario Estrada on


Description

More complicated mustache

Preparation HTML

<script src="http://me.development.s3.amazonaws.com/handlebars.js"></script>
<script src="https://raw.github.com/twitter/hogan.js/master/web/builds/2.0.0/hogan-2.0.0.min.js"></script>
<script src="https://raw.github.com/janl/mustache.js/master/mustache.js"></script>

Setup

var template = "<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: function() {
        return true;
      }
    };
    
    var handlebarsRenderer = Handlebars.compile(template);
    var hoganRenderer = Hogan.compile(template);

Test runner

Ready to run.

Testing in
TestOps/sec
Handlebars
handlebarsRenderer(context);
ready
Hogan
hoganRenderer.render(context);
ready
Mustache
Mustache.to_html(template, context);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.