Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
demo arr sort and math max min
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0) Gecko/20100101 Firefox/142.0
Browser:
Firefox 142
Operating system:
Windows
Device Platform:
Desktop
Date tested:
7 months ago
Test name
Executions per second
Use sort method
3698863.8 Ops/sec
Use max min
43028660.0 Ops/sec
HTML Preparation code:
const arr = [10,-2,8,-45,17,-37,-39,50]
Script Preparation code:
const arr = [10,-2,8,-45,17,-37,-39,50]
Tests:
Use sort method
const arr = [10,-2,8,-45,17,-37,-39,50] sortedArr = arr.sort() const min = sortedArr[0] const max = sortedArr[arr.length - 1]
Use max min
const arr = [10,-2,8,-45,17,-37,-39,50] const min = Math.min(...arr) const max = Math.max(...arr)