Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Map vs Vanilla For vs For Of 1000
(version: 0)
Comparing performance of:
Map with clone vs Map vs Vanilla For vs For Of
Created:
6 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var objects = new Array(100000); objects.fill({key: 'derp'});
Tests:
Map with clone
objects.map((obj) => { obj = Object.assign({}, obj); obj.group = 'grouping'; return obj; })
Map
objects.map((obj) => { obj.group = 'grouping'; return obj; })
Vanilla For
for (let i = 0; i < objects.length; i++) { objects[i].group = 'grouping'; }
For Of
for (const obj of objects) { obj.group = 'grouping'; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
Map with clone
Map
Vanilla For
For Of
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:
fill array with value: map(callback) vs fill(value)
fill vs from vs from object
Object spread vs New map with string keys
fill array with value: map(callback) vs fill(value) 2
Comments
Confirm delete:
Do you really want to delete benchmark?