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://cdnjs.cloudflare.com/ajax/libs/jade/1.10.0/jade.min.js"></script>
<script>
var locals = {
things: [
{ a: 'blah', b: 'halb' }
, { a: 'clah', b: 'halc' }
, { a: 'clah', b: 'halc' }
, { a: 'blah', b: 'halb' }
, { a: 'clah', b: 'halc' }
, { a: 'clah', b: 'halc' }
, { a: 'clah', b: 'halc' }
, { a: 'blah', b: 'halb' }
, { a: 'blah', b: 'halb' }
, { a: 'clah', b: 'halc' }
, { a: 'blah', b: 'halb' }
]
}
var _ENCODE_HTML_RULES = {
'&': '&'
, '<': '<'
, '>': '>'
, '"': '"'
, "'": '''
}
, _MATCH_HTML = /[&<>\'"]/g;
function betterEscape(html){
return html == undefined
? ''
: String(html)
.replace(_MATCH_HTML, function(m) {
return _ENCODE_HTML_RULES[m] || m;
});
};
var jadeWithBetterEscape = {
escape: betterEscape
};
var jadeWithCurrentEscape = {
escape: jade.runtime.escape
};
function jadeOriginal(locals, jade){
var buf = [];
var jade_mixins = {};
var jade_interp;
;var locals_for_with = (locals || {});(function (things, undefined) {
buf.push("<!DOCTYPE html><html><head><title>Fortunes</title></head><body><p>Interesting website</p>");
// iterate things
;(function(){
var $$obj = things;
if ('number' == typeof $$obj.length) {
for (var $index = 0, $$l = $$obj.length; $index < $$l; $index++) {
var thing = $$obj[$index];
buf.push("<p>" + (jade.escape(null == (jade_interp = thing.a) ? "" : jade_interp)) + "</p><p>" + (jade.escape(null == (jade_interp = thing.b) ? "" : jade_interp)) + "</p>");
}
} else {
var $$l = 0;
for (var $index in $$obj) {
$$l++; var thing = $$obj[$index];
buf.push("<p>" + (jade.escape(null == (jade_interp = thing.a) ? "" : jade_interp)) + "</p><p>" + (jade.escape(null == (jade_interp = thing.b) ? "" : jade_interp)) + "</p>");
}
}
}).call(this);
buf.push("</body></html>");}.call(this,"things" in locals_for_with?locals_for_with.things:typeof things!=="undefined"?things:undefined,"undefined" in locals_for_with?locals_for_with.undefined:typeof undefined!=="undefined"?undefined:undefined));;return buf.join("");
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Jade with its current escape function |
| ready |
Jade with an optimized escape function |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.