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 testIf(x) {
if (x === 'a') {
console.log('a');
} else if (x === 'b') {
console.log('b');
} else if (x === 'c') {
console.log('c');
} else if (x === 'd') {
console.log('d');
} else if (x === 'e') {
console.log('e');
} else if (x === 'f') {
console.log('f');
} else if (x === 'g') {
console.log('g');
} else {
console.log('unknown');
}
}
function testSwitch(x) {
switch (x) {
case 'a':
console.log('a');
break;
case 'b':
console.log('b');
break;
case 'c':
console.log('c');
break;
case 'd':
console.log('d');
break;
case 'e':
console.log('e');
break;
case 'f':
console.log('f');
break;
case 'g':
console.log('g');
break;
default:
console.log('unknown');
}
}
Ready to run.
Test | Ops/sec | |
---|---|---|
if |
| ready |
switch |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.