Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
performance of filter + map vs reduce
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Android 14; Mobile; rv:130.0) Gecko/130.0 Firefox/130.0
Browser:
Firefox Mobile 130
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
reduce
31531.0 Ops/sec
filter + map
42189.8 Ops/sec
Script Preparation code:
a = []; for (i = 0; i < 1000; i++) a.push(Number(i) / 1000); filtering = (x) => (x * 114514) % 1 > 0.5; mapping = (x) => x + 0.1919; reducing = (acc, x) => { if (filtering(x)) acc.push(mapping(x)); return acc; };
Tests:
reduce
a.reduce(reducing, [])
filter + map
a.filter(filtering).map(mapping);