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
try to benchmark some js template libraries used code from : http://jsperf.com/2dom-manipulation-js-templating-vs-programatic-jquery and http://jsperf.com/dom-vs-innerhtml-based-templating
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/0.8.1/mustache.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.runtime.min.js"></script>
<script src="//twitter.github.com/hogan.js/builds/2.0.0/hogan-2.0.0.js"></script>
<div id="testcontainer" style="display: none;"></div>
<script>
var mustacheTemplate = "<div><h1 class='header'>{{header}}</h1><div class='a'>{{a}}</div><div class='b'>{{b}}<div class='c'>{{c}}<div class='d'>{{d}}<div class='e'>{{e}}<div class='f'>{{f}}</div></div></div></div></div></div>";
var underscoreTemplate = "<div><h1 class='header'><%=header%></h1><div class='a'><%=a%></div><div class='b'><%=b%><div class='c'><%=c%><div class='d'><%=d%><div class='e'><%=e%><div class='f'><%=f%></div></div></div></div></div></div>";
var mustacheCompiled = Mustache.parse(mustacheTemplate);
var handlebarsTemplate = Handlebars.compile(mustacheTemplate);
var underscoreTemplateCompiled = _.template(underscoreTemplate );
var hoganTemplate = Hogan.compile(mustacheTemplate);
var sharedVariables = {
header: "Header",
a: 'aaa',
b: 'bbb',
c: 'ccc',
d: 'ddd',
e: 'eee',
f: 'fff'
};
$("#testcontainer").empty();
</script>Ready to run.
| Test | Ops/sec | |
|---|---|---|
| mustache | | ready |
| underscore | | ready |
| string format | | ready |
| underscore compiled | | ready |
| handlebars | | ready |
| hogan | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.