Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Reduce vs Filter and Map
(version: 0)
Comparing performance of:
Filter and Map vs Reduce
Created:
2 years ago
by:
Registered User
Jump to the latest result
Script Preparation code:
var arr = Array(10_000).fill(undefined).map((_, index) => index + 1)
Tests:
Filter and Map
const result = arr.filter((number) => number % 2 === 0).map((number) => number + 1)
Reduce
const result = arr.reduce((accumulator, number) => { if (number % 2 === 0) { accumulator.push(number + 1); } return accumulator; }, []);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Filter and Map
Reduce
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
8 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36
Browser/OS:
Chrome 139 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Filter and Map
11651.6 Ops/sec
Reduce
19064.9 Ops/sec
Related benchmarks:
flatMap vs reduces
flatMap vs reduce small array
Reduce vs map with empty filter
Reduce Push vs. flatMap vs 123
flatMap vs reduce flattern array
Comments
Confirm delete:
Do you really want to delete benchmark?