Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
reduce vs map-filter
(version: 0)
Comparing performance of:
map-filter vs reduce
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
const a = []; for (let i = 0; i < 10000; i++) { a.push(Number(i) / 1000 * 1000); } const mapping = x => x % 5 !== 0 ? x : undefined; const filtering = x => x; const reducing = (acc, x) => { const value = mapping(x); if (filtering(value)) acc.push(value); return acc; }
Tests:
map-filter
a.map(mapping).filter(filtering);
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:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?