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
let reg = /^[\dA-Z]+$/;
function isDigitOrUppercase(string) {
for (let j = 0; j < string.length; j++) {
let isDigit = string.charCodeAt(j) >= 48 && string.charCodeAt(j) <= 57;
let isUpperCase =
string.charCodeAt(j) >= 65 && string.charCodeAt(j) <= 90;
if (!isDigit && !isUpperCase) return false;
}
return true;
}
function testWithReg(string) {
string.match(reg);
}
function testWithCharCode(string) {
isDigitOrUppercase(string);
}
Ready to run.
Test | Ops/sec | |
---|---|---|
With RegExp (worst case) |
| ready |
With CharCode (worst case) |
| ready |
With RegExp (best case) |
| ready |
With CharCode (best case) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.