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>
var theVar = 'j';
var cases = {};
cases['a'] = function() {};
cases['b'] = function() {};
cases['c'] = function() {};
cases['d'] = function() {};
cases['e'] = function() {};
cases['f'] = function() {};
cases['g'] = function() {};
cases['h'] = function() {};
cases['i'] = function() {};
cases['j'] = function() {};
function switchcase(theVar){
switch (theVar) {
case 'a':
cases['a']();
break;
case 'b':
cases['b']();
break;
case 'c':
cases['c']();
break;
case 'd':
cases['d']();
break;
case 'e':
cases['e']();
break;
case 'f':
cases['f']();
break;
case 'g':
cases['g']();
break;
case 'h':
cases['h']();
break;
case 'i':
cases['i']();
break;
case 'j':
cases['j']();
break;
default:
}
}
function Hash(theVar){
if (typeof cases[theVar] == 'function') {
cases[theVar]();
}
}
function ifelse(theVar){
if (theVar === 'a') {
cases['a']()
} else if (theVar === 'b') {
cases['b']()
} else if (theVar === 'c') {
cases['c']()
} else if (theVar === 'd') {
cases['d']()
} else if (theVar === 'e') {
cases['e']()
} else if (theVar === 'f') {
cases['f']()
} else if (theVar === 'g') {
cases['g']()
} else if (theVar === 'h') {
cases['h']()
} else if (theVar === 'i') {
cases['i']()
} else if (theVar === 'j') {
cases['j']()
}
else {
}
}
function Access(theVar){
var cb = cases[theVar];
if (cb) {
cb();
}
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Switch |
| ready |
Hash |
| ready |
If else |
| ready |
Access |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.