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 brief comparison of some JavaScript templating engines on a short template: 7 DOM nodes ... 7 interpolated values.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://yui.yahooapis.com/3.5.0/build/yui/yui-min.js"></script>
<script src="http://beebole.com/pure/wp-content/themes/BeeBole-pure/libs/pure.js"></script>
<script src="http://documentcloud.github.com/underscore/underscore.js"></script>
<script src="http://mustache.github.com/extras/mustache.js"></script>
<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>
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>";
window.underscoreTemplate = _.template("<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>");
window.subTemplate = "<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>";
window.sharedVariables = {
header: "Header",
a: 'aaa',
b: 'bbb',
c: 'ccc',
d: 'ddd',
e: 'eee',
f: 'fff'
};
var SUB;
var Y = YUI().use('substitute', function (Y) {
SUB = Y.substitute;
});
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Mustache.js Template |
| ready |
Pure JS Template |
| ready |
Underscore.js Template |
| ready |
YUI sub template |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.