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 createObject(n){
let ret = {};
for (let i=0; i<n; i++)
ret["item"+i] = i;
return ret;
}
function createObjects(mult, frozen, sealed, noXt){
let n = 1;
let ret = [];
for (let i=0; i<mult; i++){
let obj = createObject(n);
if (frozen)
Object.freeze(obj);
else if (sealed)
Object.seal(obj);
else if (noXt)
Object.preventExtensions(obj);
ret.push(obj);
if (n===1)
n=10;
else
n*=10;
}
return ret;
}
function enumerateAll(obj){
let n=0;
for (let key in obj)
n++;
return n;
}
const m = 4;
const control = createObjects(m);
const frozen = createObjects(m, true);
const sealed = createObjects(m, false, true);
const noXt = createObjects(m, false, false, true);
Ready to run.
Test | Ops/sec | |
---|---|---|
Enumerate the single own property of control object (non-frozen, non-sealed, non-extension prevented) |
| ready |
Enumerate the single own property of frozen object |
| ready |
Enumerate the single own property of sealed object |
| ready |
Enumerate the single own property of object with extensions prevented |
| ready |
Enumerate all 10 own properties of control object (non-frozen, non-sealed, non-extension prevented) |
| ready |
Enumerate all 10 own properties of frozen object |
| ready |
Enumerate all 10 own properties of sealed object |
| ready |
Enumerate all 10 own properties of object with extensions prevented |
| ready |
Enumerate all 100 own properties of control object (non-frozen, non-sealed, non-extension prevented) |
| ready |
Enumerate all 100 own properties of frozen object |
| ready |
Enumerate all 100 own properties of sealed object |
| ready |
Enumerate all 100 own properties of object with extensions prevented |
| ready |
Enumerate all 1000 own properties of control object (non-frozen, non-sealed, non-extension prevented) |
| ready |
Enumerate all 1000 own properties of frozen object |
| ready |
Enumerate all 1000 own properties of sealed object |
| ready |
Enumerate all 1000 own properties of object with extensions prevented |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.