Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
demo arr sort and math max min
(version: 0)
Comparing performance of:
Use sort method vs Use max min
Created:
3 years ago
by:
Guest
Jump to the latest result
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)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Use sort method
Use max min
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
7 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0) Gecko/20100101 Firefox/142.0
Browser/OS:
Firefox 142 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Use sort method
3698863.8 Ops/sec
Use max min
43028660.0 Ops/sec
Related benchmarks:
arr.sort((a, b) => a - b)[0] vs. Math.min(...arr)
.sort() vs Math.min / Math.max
demo arr sort and math max min v3
demo arr sort and math max min v4
Comments
Confirm delete:
Do you really want to delete benchmark?