t-bench2

Benchmark created by jacob on


Description

More complicated mustache

Preparation HTML

<script src="https://github.com/downloads/wycats/handlebars.js/handlebars-1.0.0.beta.6.js"></script>
<script src="http://twitter.github.com/hogan.js/builds/1.0.3/hogan.js"></script>
<script src="http://github.com/janl/mustache.js/raw/master/mustache.js"></script>

Setup

var template = "<strong>This is a slightly more complicated {{thing}}.</strong>. Check this out: {{#hasThings}}<ul>{{#things}}<li class={{class}}>{{word}}</li>{{/things}}</ul>.{{/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
Mustache
Mustache.to_html(template, context);
ready
Hogan
hoganRenderer.render(context);
ready

Revisions

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