Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Reduce vs Filter and Map
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36
Browser:
Chrome 122
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Reduce
18K/s
Filter and Map
15K/s
View exact numbers
Test name
Executions per second
✓
Reduce
18,329 Ops/sec
Filter and Map
14,752 Ops/sec
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; }, []);