Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
for of vs filter().map()
(version: 1)
for of vs filter map
Comparing performance of:
filter().map() vs for of
Created:
one year ago
by:
Guest
Go to the latest result
Script Preparation code:
var arr = []; var i = 0; while (i <= 1E5) arr[i] = i++;
Tests:
filter().map()
arr.filter(x => x % 3).map(x => x/100)
for of
let result = []; for (const x of result) { if (x % 3) { result.push(x/100); } }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
filter().map()
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/138.0.0.0 Safari/537.36
Browser/OS:
Chrome 138 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
for of
171.8M/s
filter().map()
542/s
View exact numbers
Test name
Executions per second
✓
for of
171,837,488 Ops/sec
filter().map()
542 Ops/sec
Related benchmarks
Reduce vs Filter/Map vs Map/Filter
flatMap() vs filter().map() vs for loop accumulator
flatMap() vs filter().map() vs for loop accumulator vs forEach
flatMap() vs filter().map() vs for loop accumulator vs forEach vs for of loop
Comments
Confirm delete:
Do you really want to delete benchmark?