Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
sumby with reduce vs by mapping first
(version: 1)
Comparing performance of:
map first vs just reduce
Created:
one year ago
by:
Guest
Go to the latest result
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)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
map first
just reduce
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
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/OS:
Chrome 135 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
just reduce
1K/s
map first
316/s
View exact numbers
Test name
Executions per second
✓
just reduce
1,036 Ops/sec
map first
316 Ops/sec
Related benchmarks
Get max from an array of numbers (Math.max vs. iteration) V3
flatMap vs reduce vs filter.map
flatMap vs reduce vs filter.map v2
flatMap vs reduce filtering performance
Comments
Confirm delete:
Do you really want to delete benchmark?