Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Math.max + Math.min and reduce
(version: 1)
Comparing performance of:
2 Reducers vs 1 Reducer
Created:
6 months ago
by:
Registered User
Go to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
var data = Array.from({ length: 1000000 }, (_, i) => i)
Tests:
2 Reducers
const max = data.reduce( (m, x) => x > m ? x : m, -Infinity ); const min = data.reduce( (m, x) => x < m ? x : m, Infinity );
1 Reducer
data.reduce( ({ min, max }, value) => ({ max: Math.max(max, value), min: Math.min(min, value), }), { min: Infinity, max: -Infinity }, );
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
2 Reducers
1 Reducer
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
6 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36
Browser/OS:
Chrome 143 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
1 Reducer
140/s
2 Reducers
83/s
View exact numbers
Test name
Executions per second
✓
1 Reducer
140 Ops/sec
2 Reducers
83 Ops/sec
Related benchmarks
Math.min and Math.max vs reduce vs for for 100000 items.
Math.max() vs Array.reduce()
Math.min() vs Array.reduce()
Math.max.apply() vs Array.reduce()
Comments
Confirm delete:
Do you really want to delete benchmark?