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>
(function initMyTest(global) {
var a = 1, b = true, c = 'c', d = [], e = {}, u, module = {};
function typeOfStrict(v) {
return typeof v === 'undefined';
}
function typeOfNonStrict(v) {
return typeof v == 'undefined';
}
function globalUndefined(v) {
return v === undefined;
}
function localUndefined(v) {
return v === u;
}
function localUndefinedFn(v, u) {
return v === u;
}
function void0(v) {
return v === void 0;
}
function test(fn, args) {
if (fn(a)) {
throw new Error('');
}
if (fn(b)) {
throw new Error('');
}
if (fn(c)) {
throw new Error('');
}
if (fn(d)) {
throw new Error('');
}
if (fn(e)) {
throw new Error('');
}
}
test(void0);
test(typeOfStrict);
test(typeOfNonStrict);
test(globalUndefined);
test(localUndefined);
test(localUndefinedFn);
module.test = test;
module.void0 = void0;
module.typeOfStrict = typeOfStrict;
module.typeOfNonStrict = typeOfNonStrict;
module.globalUndefined = globalUndefined;
module.localUndefined = localUndefined;
module.localUndefinedFn = localUndefinedFn;
global.myTest = module;
}(window));
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
typeof strict |
| ready |
typeof non-strict |
| ready |
global undefined |
| ready |
local undefined |
| ready |
local undefined (fn) |
| ready |
void 0 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.