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
<script src="http://code.jquery.com/jquery-2.1.3.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/mustache.js/0.8.1/mustache.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/3.0.2/handlebars.min.js"></script>
<script type="text/javascript" src="http://cdn.rawgit.com/linkedin/dustjs/master/dist/dust-full.min.js"></script>
<script type="text/javascript" src="http://twitter.github.com/hogan.js/builds/3.0.1/hogan-3.0.1.js"></script>
<script type="text/javascript" src="http://cdn.rawgit.com/HenrikJoreteg/ICanHaz.js/master/ICanHaz.min.js"></script>
<script type="text/javascript" src="http://cdn.rawgit.com/adammark/Markup.js/master/src/markup.min.js"></script>
<script type="text/javascript" src="http://cdn.rawgit.com/olado/doT/master/doT.min.js"></script>
<script>
window.sharedVariables = {
header: "Header",
a: 'aaa',
b: 'bbb',
c: 'ccc',
d: 'ddd',
e: 'eee',
f: 'fff',
obj: {
A: 'AAA',
B: 'BBB'
},
arr: [
'arrA',
'arrB',
'arrC'
],
fn: function () {
return 'fnfn';
}
};
window.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 class='obj'>{{obj.A}} {{obj.B}}</div>" +
"<div class='arr'>{{arr}}</div>" +
"<div class='fn'>{{fn}}</div>" +
"</div>";
window.mustacheTemplatePreparse =
"<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 class='obj'>{{obj.A}} {{obj.B}}</div>" +
"<div class='arr'>{{arr}}</div>" +
"<div class='fn'>{{fn}}</div>" +
"</div>";
Mustache.parse(window.mustacheTemplatePreparse);
window.handlebarsTemplate =
"<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 class='obj'>{{obj.A}} {{obj.B}}</div>" +
"<div class='arr'>{{arr}}</div>" +
"<div class='fn'>{{fn}}</div>" +
"</div>";
window.handlebarsTemplatePrecompile = Handlebars.compile(window.handlebarsTemplate);
window.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 class='obj'>{obj.A} {obj.B}</div>" +
"<div class='arr'>{arr}</div>" +
"<div class='fn'>{fn}</div>" +
"</div>";
dust.loadSource(dust.compile(window.dustTemplate, 'dustTemplatePrecompile'));
window.hoganTemplate =
"<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 class='obj'>{{obj.A}} {{obj.B}}</div>" +
"<div class='arr'>{{arr}}</div>" +
"<div class='fn'>{{fn}}</div>" +
"</div>";
window.hoganTemplatePrecompile = Hogan.compile(window.hoganTemplate);
window.ichTemplate =
"<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 class='obj'>{{obj.A}} {{obj.B}}</div>" +
"<div class='arr'>{{arr}}</div>" +
"<div class='fn'>{{fn}}</div>" +
"</div>";
ich.addTemplate('ichTemplatePrecompile', window.ichTemplate);
window.markupTemplate =
"<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 class='obj'>{{obj.A}} {{obj.B}}</div>" +
"<div class='arr'>{{arr}}</div>" +
"<div class='fn'>{{fn}}</div>" +
"</div>";
window.doTTemplate =
"<div>" +
"<h1 class='header'>{{=it.header}}</h1><div class='a'>{{=it.a}}</div><div class='b'>{{=it.b}}<div class='c'>{{=it.c}}<div class='d'>{{=it.d}}<div class='e'>{{=it.e}}<div class='f'>{{=it.f}}</div></div></div></div></div>" +
"<div class='obj'>{{=it.obj.A}} {{=it.obj.B}}</div>" +
"<div class='arr'>{{~it.arr :value}}{{=value}}{{~}}</div>" +
"<div class='fn'>{{=it.fn()}}</div>" +
"</div>";
window.doTTemplatePrecompile = doT.compile(window.doTTemplate);
$(function () {
window.placeholder = $('#placeholder');
});
</script>
<div id="placeholder"></div>
Ready to run.
Test | Ops/sec | |
---|---|---|
Mustache.js |
| ready |
Handlebars.js |
| ready |
Dust.js |
| ready |
Hogan |
| ready |
ICanHaz |
| ready |
Markup |
| ready |
Mustache.js Preparse |
| ready |
Handlebars.js Precompile |
| ready |
Dust.js Precompile |
| ready |
Hogan Precompile |
| ready |
ICanHaz Precompile |
| ready |
doT (logic) - Precompile |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.