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){
let n = 1;
let ret = [];
for (let i=0; i<mult; i++){
let obj = createObject(n);
if (frozen)
Object.freeze(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;
}
let m = 4;
let nonFrozenObjects = createObjects(m, false);
let frozenObjects = createObjects(m, true);
Ready to run.
Test | Ops/sec | |
---|---|---|
Enumerate the single own property of non-frozen object |
| ready |
Enumerate the single own property of frozen object |
| ready |
Enumerate all 10 own properties of non-frozen object |
| ready |
Enumerate all 10 own properties of frozen object |
| ready |
Enumerate all 100 own properties of non-frozen object |
| ready |
Enumerate all 100 own properties of frozen object |
| ready |
Enumerate all 1000 own properties of non-frozen object |
| ready |
Enumerate all 1000 own properties of frozen object |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.