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:
3 months ago
by:
Registered User
Jump 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:
3 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
Test name
Executions per second
2 Reducers
83.2 Ops/sec
1 Reducer
140.3 Ops/sec
Related benchmarks:
Max and Min values
Max and Min values
Max and Min values
Math.min and Math.max vs reduce vs for for 100000 items.
Math.max() vs Array.reduce()
Math.min() vs Array.reduce()
Math.max() vs Array.reduce() xxx
Math.max() vs Array.reduce() xxxyyy
Math.max.apply() vs Array.reduce()
Comments
Confirm delete:
Do you really want to delete benchmark?