Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
iterate array
(version: 0)
Find various ways of iterating through an array
Comparing performance of:
Using entries vs Raw for loop
Created:
one year ago
by:
Registered User
Jump to the latest result
Script Preparation code:
const data = new Array(1000) for(let i = 0; i < data.length; i++) { data.push({ id: i, name: "item-" + i, attribute: i, editable: i }) }
Tests:
Using entries
for(const [idx, item] of data.entries()) { item.editable += 1 }
Raw for loop
for(let j = 0; j < data.length; j++) { data[j].editable += 1 }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Using entries
Raw for loop
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?