Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
lodash forEach vs for i loop vs native forEach
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:134.0) Gecko/20100101 Firefox/134.0
Browser:
Firefox 134
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Benchmark engine:
Benchmark.js
native forEach
38.1M/s
native for
37.0M/s
lodash.forEach
16.6M/s
View exact numbers
Test name
Executions per second
✓
native forEach
38,108,048 Ops/sec
native for
36,988,240 Ops/sec
lodash.forEach
16,631,724 Ops/sec
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/lodash/4.17.15/lodash.min.js"></script>
Script Preparation code:
var values = [{a: 30310}, {b: 100303}, {c: 3040494}]
Tests:
lodash.forEach
var count = 0; _.forEach(values, function(v,i) { if (v.a != null) { count++; } })
native for
var count = 0; for (var i = 0; i < values.length; i++) { if (values[i].a != null) { count++; } }
native forEach
var count = 0; values.forEach(function(v) { if (v.a != null) { count++; } })