Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
lodash forEach vs native forEach vs for of
(version: 1)
Comparing performance of:
lodash.forEach vs native forEach vs for of
Created:
one year ago
by:
Guest
Go to the latest result
HTML Preparation code:
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js"></script>
Script Preparation code:
var arr = Array.from({ length: 10000 }).map((value, i) => i);
Tests:
lodash.forEach
_.forEach(arr, () => {})
native forEach
arr.forEach(() => {})
for of
for (const i of arr) {}
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
lodash.forEach
native forEach
for of
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Browser/OS:
Chrome 135 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
for of
427K/s
native forEach
370K/s
lodash.forEach
19K/s
View exact numbers
Test name
Executions per second
✓
for of
426,627 Ops/sec
native forEach
370,348 Ops/sec
lodash.forEach
18,599 Ops/sec
Related benchmarks
lodash vs for-of vs forEach3
native for loop vs Array.prototype.forEach vs lodash forEach
lodash .foreach vs native foreach vs for..of..
Comments
Confirm delete:
Do you really want to delete benchmark?