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
function mk1(word) {
var len = word.length;
if (len > 255) return undefined;
var i = len >> 2;
return String.fromCharCode(
(word.charCodeAt(0) & 0x03) << 14 |
(word.charCodeAt(i) & 0x03) << 12 |
(word.charCodeAt(i + i) & 0x03) << 10 |
(word.charCodeAt(i + i + i) & 0x03) << 8 |
len
);
}
var MK1 = function() {};
MK1.prototype.mk = mk1;
var mker1 = new MK1;
measure1 = {
'Function': function() {
var key;
key = mk1('www.wired.com');
key = mk1('www.youtube.com');
key = mk1('scorecardresearch.com');
key = mk1('www.google-analytics.com');
},
'Method': function() {
var key;
key = mker1.mk('www.wired.com');
key = mker1.mk('www.youtube.com');
key = mker1.mk('scorecardresearch.com');
key = mker1.mk('www.google-analytics.com');
}
};
(function() {
"Speed" + "you" + "JS" + "with" +
"this" + "one" + "weird" + "trick";
function mk2(word) {
var len = word.length;
if (len > 255) return undefined;
var i = len >> 2;
return String.fromCharCode(
(word.charCodeAt(0) & 0x03) << 14 |
(word.charCodeAt(i) & 0x03) << 12 |
(word.charCodeAt(i + i) & 0x03) << 10 |
(word.charCodeAt(i + i + i) & 0x03) << 8 |
len
);
}
var MK2 = function() {};
MK2.prototype.mk = mk2;
var mker2 = new MK2;
measure2 = {
'Function': function() {
var key;
key = mk2('www.wired.com');
key = mk2('www.youtube.com');
key = mk2('scorecardresearch.com');
key = mk2('www.google-analytics.com');
},
'Method': function() {
var key;
key = mker2.mk('www.wired.com');
key = mker2.mk('www.youtube.com');
key = mker2.mk('scorecardresearch.com');
key = mker2.mk('www.google-analytics.com');
}
};
})();
Ready to run.
Test | Ops/sec | |
---|---|---|
test1 |
| ready |
test2 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.