Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
sumby with reduce vs by mapping first
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/135.0.0.0 Safari/537.36
Browser:
Chrome 135
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
map first
315.9 Ops/sec
just reduce
1035.9 Ops/sec
Script Preparation code:
const arr = Array.from({ length: 100000 }, () => ({ rand: Math.random() }));
Tests:
map first
var b = arr.map((obj) => obj.rand).reduce((acc, curr) => acc + curr, 0);
just reduce
var b = arr.reduce((acc, curr) => acc + curr.rand, 0)