Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Object reading JS - 2
(version: 0)
Comparing performance of:
for in vs for classic vs for classic values vs for classic fixed keys
Created:
3 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<div id="show"></div>
Script Preparation code:
var obj = {} var maxsize = 100 for (let i = 0; i < maxsize; i++) { obj[`i_${i}`] = i; }
Tests:
for in
let total = 0; for (let k in obj) { const test = obj[k] + 1; total += test; }
for classic
let total = 0; const keys = Object.keys(obj) for (let i = 0; i < maxsize; i++) { const test = obj[keys[i]] + 1; total += test; }
for classic values
let total = 0; const values = Object.values(obj) for (let i = 0; i < maxsize; i++) { const test = values[i] + 1; total += test; }
for classic fixed keys
let total = 0; const keys = Object.keys(obj) for (let i = 0; i < maxsize; i++) { const test = obj[`i_${i}`] + 1; total += test; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
for in
for classic
for classic values
for classic fixed 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!
Related benchmarks:
dsdsds
Lodash.js Each vs Native Objects Keys and Each
Object reading JS
for in loop
Comments
Confirm delete:
Do you really want to delete benchmark?