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 ifElseTest(stuff) {
if(stuff === 1) {
return 1;
} else if (stuff === 2) {
return 2;
} else if (stuff === 3) {
return 3;
} else if (stuff === 4) {
return 4;
} else if (stuff === 5) {
return 5;
} else if (stuff === 6) {
return 6;
}
};
function switchTest(stuff) {
switch (stuff) {
case 1:
return 1;
break;
case 2:
return 2;
break;
case 3:
return 3;
break;
case 4:
return 4;
break;
case 5:
return 5;
break;
case 6:
return 6;
break;
}
};
var lookupTable = [
function() 1,
function() 2,
function() 3,
function() 4,
function() 5,
function() 6,
];
Ready to run.
Test | Ops/sec | |
---|---|---|
if else |
| ready |
switch |
| ready |
lookup table |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.