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
A test to show benchmark for popular JS templaters.
<script type="text/javascript" src="https://rawgithub.com/olado/doT/master/doT.js">
</script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.1.0/handlebars.min.js"></script>
<script type="text/javascript">
window.sharedVariables = [{
first_name: 'Alex',
last_name: null,
age: 24,
gender: 'male'
},
{
first_name: 'Jane',
last_name: 'Painkiller',
age: 26,
gender: 'female'
}];
window.dotTemplate = '{{~it:x}}<li class="people {{=x.gender}}"><span class="name">{{=x.first_name}}{{? x.last_name}} {{=x.last_name}}{{?}}</span><span class="age">{{=x.age}}</span></li>{{~}}';
window.dotCompiled = doT.template(dotTemplate);
window.handlebarsTemplate = '{{#.}}<li class="people {{gender}}"><span class="name">{{first_name}}{{#if last_name}} {{last_name}}{{/if}}</span><span class="age">{{age}}</span></li>{{/.}}';
window.handlebarsCompiled = Handlebars.compile(handlebarsTemplate);
</script>
var tplStr = document.getElementById('tpl').innerHTML;
var tplVash = vash.compile(tplStr, { modelName: 'it', debug: false });
var model = {
Do: 'DO',
realize: function(){ return 'REALIZE' },
everyone: function(p){ return { go: p }; },
floating: 'FLOATING'
}
Ready to run.
Test | Ops/sec | |
---|---|---|
doT.js precompiled |
| ready |
Handlebars.js precompiled |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.