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="https://rawgithub.com/rhyzx/lt/master/lt.js"></script>
<script src="https://rawgithub.com/janl/mustache.js/master/mustache.js"></script>
<script src="https://github.com/downloads/wycats/handlebars.js/handlebars-1.0.rc.1.min.js"></script>
<script src="https://rawgithub.com/archan937/templayed.js/master/src/templayed.js"></script>
<script src="https://rawgithub.com/twitter/hogan.js/master/web/1.0.0/hogan.min.js"></script>
<script src="https://rawgithub.com/akdubya/dustjs/master/dist/dust-full-0.3.0.min.js"></script>
var bench = [{ // non
source: 'Hello world',
data: {}
}, { // basic
source: 'Hello {{name}}! You have {{count}} new messages.',
data: { name: 'Mick', count: 30 }
}, { // if
source: '{{#check}}pass{{/check}}',
data: { check: true }
}, { // use obj
source: '{{#person}}{{name}}{{age}}{{/person}}',
data: { person: { name: 'Larry', age: 45 } }
}, { // iterator list
source: '{{#names}}{{name}}{{/names}}',
data: { names: [{name: 'Moe'}, {name: 'Larry'}, {name: 'Curly'}, {name: 'Shemp'}] }
}, { // invert
source: '{{^not}}show me the money{{/not}}',
data: { not: false }
}, { // complex
source: (function () {/*
<header>{{header}}</header>
<ul>
{{#items}}
<li>{{name}} : {{value}}</li>
{{/items}}
</ul>
{{#footer}}
<footer>{{footer}}</footer>
{{/footer}}
*/}).toString().slice(16, -4),
data: { header: 'this is header', items: [
{name: 'a'}, {name: 'b'}, {name: 'c'}, {name: 'd'}, {name: 'e'},
{name: 'a'}, {name: 'b'}, {name: 'c'}, {name: 'd'}, {name: 'e'},
{name: 'a'}, {name: 'b'}, {name: 'c'}, {name: 'd'}, {name: 'e'}
]}
}]
// pre-compile
for (var i=0, len=bench.length; i<len; i++) {
var item = bench[i]
item.lt = lt.compile(item.source)
item.hogan = Hogan.compile(item.source)
// item.mustache = Mustache.parse(item.source)
item.handlebars = Handlebars.compile(item.source)
// item.handlebars({}) // disable Handlebar lazy-compile
// item.templayed = templayed(item.source)
}
Ready to run.
Test | Ops/sec | |
---|---|---|
#Hogan.js |
| ready |
#Mustache |
| ready |
#Handlebars |
| ready |
#Templayed |
| ready |
#LT |
| ready |
#LT - precompiled |
| ready |
#Hogan.js - precompiled |
| ready |
#Dust.js |
| ready |
Handlebars.js precompiled |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.