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
Compare Object.keys to for(key in obj) for testing if an object is empty
var obj = {},
obj_sm = {},
i;
for (i = 0; i < 10000; i++) {
obj["abc_" + i] = null;
}
for (i = 0; i < 10; i++) {
obj_sm["abc_" + i] = null;
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Object.keys |
| ready |
for var in obj |
| ready |
Object.keys small |
| ready |
for var in obj small |
| ready |
JSON.stringify |
| ready |
JSON.stringify Small |
| ready |
getOwnPropertyNames |
| ready |
getOwnPropertyNames small |
| ready |
Object.keys 2 |
| ready |
Object.keys small 2 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.