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
var type = typeof 1;
var r;
var assigningFunctionHandlers = {
"boolean": function() {
r = 'boolean';
},
"function": function() {
r = 'function';
},
"object": function() {
r = 'object';
},
"string": function() {
r = 'string';
},
"number": function() {
r = 'number';
}
};
var returningFunctionHandlers = {
"boolean": function() {
return 'boolean';
},
"function": function() {
return 'function';
},
"object": function() {
return r 'object';
},
"string": function() {
return r 'string';
},
"number": function() {
return r 'number';
}
};
var stringDictionaryLookup = {
"boolean": 'boolean',
"function": 'function',
"object": 'object',
"string": 'string',
"number": 'number'
};
Ready to run.
Test | Ops/sec | |
---|---|---|
switch with type shifting |
| ready |
else-if with type shifting |
| ready |
switch (strings only) |
| ready |
else if (string only) |
| ready |
to the point |
| ready |
assigning dictionary lookup |
| ready |
returning dictionary lookup |
| ready |
string dictionary lookup |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.