jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
More complicated mustache
<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>
<script src="http://closure-templates.googlecode.com/svn/trunk/javascript/soyutils.js"></script>
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);
var hoganRenderer = Hogan.compile(template);
// {namespace closureSoyTemplate}
//
// /**
// * Says hello to the world.
// * @param things
// * @param hasThings
// */
// {template .test}
// <strong>
// This is a slightly more complicated $thing.
// </strong>.
// Check this out:
//
// {if $hasThings}
//
// <ul>
// {foreach $t in $things}
// <li class=$t.class>$t.word</li>
// {ifempty}
// {/foreach}
// </ul>.
//
// {else}
//
// <small>Nothing to check out...</small>
//
// {/if}
// {/template}
var closureSoyTemplate = function(opt_data, opt_sb) {
var output = opt_sb || new soy.StringBuilder();
output.append('<strong>This is a slightly more complicated $thing.</strong>. Check this out:');
if (opt_data.hasThings) {
output.append('<ul>');
var tList7 = opt_data.things;
var tListLen7 = tList7.length;
if (tListLen7 > 0) {
for (var tIndex7 = 0; tIndex7 < tListLen7; tIndex7++) {
var tData7 = tList7[tIndex7];
output.append('<li class=$t.class>$t.word</li>');
}
} else {
}
output.append('</ul>.');
} else {
output.append('<small>Nothing to check out...</small>');
}
if (!opt_sb) return output.toString();
};
Ready to run.
Test | Ops/sec | |
---|---|---|
Handlebars |
| ready |
Hogan |
| ready |
Mustache |
| ready |
closure soy |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.