Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
for let vs Object.keys
(version: 0)
Comparing performance of:
for let i in vs for let i of vs Object.keys (cached) vs Object.keys
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
const object = {}; let sum = 0; for (let i = 0; i < 1000; i++) object["property_" + Math.random()] = Math.random(); const keys = Object.keys(object);
Tests:
for let i in
for (let i in object) sum += object[i];
for let i of
for (let i of object) sum += i;
Object.keys (cached)
for (let i = 0 ; i < keys.length ; i++) sum += object[keys[i]];
Object.keys
const newKeys = Object.keys (object); for (let i = 0 ; i < newKeys.length ; i++) sum += object[newKeys[i]];
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
for let i in
for let i of
Object.keys (cached)
Object.keys
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?