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
All that a obj.hasOwnProperty() method can return is in Object.keys(obj). Is it faster lookup an index than inspect an object?
var
obj = {
aaa: 1,
bbb: 1,
ccc: 1,
ddd: 1,
eee: 1,
fff: 1,
ggg: 1,
hhh: 1,
iii: 1,
jjj: 1
},
cachedObjKeys = Object.keys(obj),
objKeys
;
Ready to run.
Test | Ops/sec | |
---|---|---|
hasOwnProperty |
| ready |
Object.keys + indexOf |
| ready |
cached keys + indexOf |
| ready |
in |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.