Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
array iteration vs _.each vs map vs for
(version: 0)
Comparing performance of:
_.each vs forEach vs map vs for
Created:
7 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.core.js"></script>
Script Preparation code:
var array = ['a', 'b', 'c']
Tests:
_.each
_.each(array, (value, index) => { console.log(value) })
forEach
array.forEach((value, index) => { console.log(value) })
map
array.map((value, index) => { console.log(value) })
for
for (i = 0; i < array.length; i++) { console.log(array[i]) }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
_.each
forEach
map
for
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:
array iteration vs _.each vs map vs for..of vs for loop
Array immutable union: lodash union vs flatten and creating a new set
array.map vs _.map
lodash _.map vs native map true version
Array Map Vs Lodash Map (1)
Comments
Confirm delete:
Do you really want to delete benchmark?