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-1.11.0.min.js"></script>
<script src="http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.3.0.js"></script>
<script id="template" type="text/plain">
<div class="entry">
<h1>{{title}}</h1>
<div class="body">
{{body}}
</div>
{{#each items}}
<div>{{text}}</div>
{{/each}}
</div>
</script>
<script>
var source = $("#template").html();
var compiled = Handlebars.compile(source);
var precompiled;
eval('precompiled = '+Handlebars.precompile(source));
var precompiledCached = Handlebars.template(precompiled);
var testData = {
title: 'handlebars',
body: 'test',
items: [
{ text: 'test1' },
{ text: 'test2' },
{ text: 'test3' },
{ text: 'test4' }
]
};
function testCompile() {
var fn = Handlebars.compile(source);
fn(testData);
}
function testCompileAndCache() {
compiled(testData);
}
function testPrecompile() {
var fn = Handlebars.template(precompiled);
fn(testData);
}
function testPrecompileAndCache() {
precompiledCached(testData);
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Compile |
| ready |
Compile+Cache |
| ready |
testPrecompile |
| ready |
testPrecompileAndCache |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.