Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Get max from an array of numbers (Math.max vs. iteration) V3
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 138
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
Reduce
1.5M/s
Math.max
935K/s
View exact numbers
Test name
Executions per second
✓
Reduce
1,453,378 Ops/sec
Math.max
935,039 Ops/sec
Script Preparation code:
var arr = [...Array(500)].map(() => Math.floor(Math.random() * 100000));
Tests:
Math.max
return Math.max(...arr);
Reduce
return arr.reduce((maxi, curr) => maxi < curr ? curr : maxi, -1);