Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
for-noop vs flatMap
Comparing performance of: for-noop vs flatMap
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15
Browser:
Safari 18
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
for-noop
337K/s
flatMap
6K/s
View exact numbers
Test name
Executions per second
✓
for-noop
336,702 Ops/sec
flatMap
6,117 Ops/sec
Script Preparation code:
var arr = Array.from({length: 10_000}, () => Math.floor(Math.random() * 2));
Tests:
for-noop
for (var i = 0; i < arr.length; i++) {}
flatMap
arr.flatMap((x) => (x !== 0 ? [x] : []));