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="//beebole.com/pure/wp-content/themes/BeeBole-pure/libs/pure.js"></script>
<script src="//documentcloud.github.com/underscore/underscore.js"></script>
<script src="//mustache.github.com/extras/mustache.js"></script>
<script src="//json2html.com/js/json2html.js"></script>
<script src="//json2html.com/js/jquery.json2html.js"></script>
<script src="//json2html.com/js/json2html-transform-helper.js"></script>
<script src="//builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.3.0.js"></script>
<script src="//akdubya.github.io/dustjs/dist/dust-full-0.3.0.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>
<div class="purejs_template"><div><h1 class="header"></h1><div class='a'></div><div class='b'><div class='c'><div class='d'><div class='e'><div class='f'></div></div></div></div></div></div></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 dustTemplate="<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 handlebarTemplate = Handlebars.compile(mustacheTemplate);
var underscoreTemplateCompiled = _.template(underscoreTemplate );
var dustFn = dust.compile(dustTemplate);
var hoganTemplate = Hogan.compile(mustacheTemplate);
var sharedVariables = {
header: "Header",
a: 'aaa',
b: 'bbb',
c: 'ccc',
d: 'ddd',
e: 'eee',
f: 'fff'
};
$("#testcontainer").empty();
var values = ["SOMETHING", "THOMAS","THOMAS","THOMAS","THOMAS","THOMAS","THOMAS","THOMAS","THOMAS","THOMAS","THOMAS","THOMAS","THOMAS","THOMAS","THOMAS","THOMAS","THOMAS","THOMAS","THOMAS","THOMAS","THOMAS","THOMAS","THOMAS"];
</script>Ready to run.
| Test | Ops/sec | |
|---|---|---|
| mustache | | ready |
| pure js | | ready |
| underscore | | ready |
| json2html | | ready |
| string format | | ready |
| underscore compiled | | ready |
| handlebars | | ready |
| dust | | ready |
| hogan | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.