HTML Preparation code:
AخA
 
1
<script src="https://s3.amazonaws.com/builds.handlebarsjs.com/handlebars.min-v4.7.8.js"></script>
2
<script src="https://unpkg.com/mustache@4.2.0/mustache.min.js"></script>
Script Preparation code:
x
 
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: true
};
var handlebarsRenderer = Handlebars.compile(template);
Mustache.parse(template);
Tests:
  • Handlebars

     
    handlebarsRenderer(context);
  • Mustache

     
    Mustache.render(template, context);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Handlebars
    Mustache

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 7 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
Chrome 128 on Windows
View result in a separate tab
Test name Executions per second
Handlebars 200307.1 Ops/sec
Mustache 338529.0 Ops/sec