Let's get started!
VM73:13 Object.keys took: 20234.000000054948msecs
VM73:19 Object.values took: 5987.800000002608msecs
It turns out that Object.values
is about 3.2
times faster than Object.keys
in Chrome v67
.
Note: Things might change in the future and I've only tested it in Chrome really, so take the results with a grain of salt!
I don't know much about V8 or node or anything, but I ran these locally and I think it's because you used numeric keys so V8 treated it similarly to an array so
Object.values().length
was similar toarray.length
I ran:
on node v11.10.1 and got: