Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
filter-map vs reduce with spread
(version: 1)
modified version of `map-filter vs reduce` that switches the order of operations
Comparing performance of:
map-filter vs reduce
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
a=[]; for(i=0;i<1000;i++) a.push(Number(i)/1000); var filtering=x=>(x*114514)%1>0.5; var mapping=x=>x+0.1919; var reducing=(acc,x)=>{ var value=mapping(x); if(!filtering(value)) return acc; return [...acc, value]; }
Tests:
map-filter
a.filter(filtering).map(mapping);
reduce
a.reduce(reducing,[]);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
map-filter
reduce
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
9 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0
Browser/OS:
Firefox 141 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
map-filter
278671.4 Ops/sec
reduce
2870.9 Ops/sec
Related benchmarks:
map-filter vs reduce
filter-map vs reduce
filter-map vs reduce fixed
filter-map vs reduce PSOW
filter-map vs reduce, fixed.
filter-map vs reduce 2
Compare multiple filter / map with reduce
filter-map vs reduceggg
filter-map vs reduce 100k
Comments
Confirm delete:
Do you really want to delete benchmark?