Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
sorting an array and then reverse vs sorting with reversive comparison
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0
Browser:
Firefox 121
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
sorting an array and then reverse
240470.7 Ops/sec
sorting with reversive comparison
243245.0 Ops/sec
Tests:
sorting an array and then reverse
const arr = [ 83, 52, 100, 58, 20, 41, 53, 19, 27, 60, 91, 2, 29, 78, 45, 49, 56, 98, 35, 66, 63, 79, 3, 61, 75, 59, 71, 65, 34, 1, 81, 74, 30, 5, 97, 57, 62, 31, 92, 43, 16, 55, 32, 8, 46, 68, 40, 12, 87, 82, 80, 54, 96, 14, 94, 88, 72, 67, 24, 85, 76, 15, 18, 17, 64, 11, 51, 25, 38, 21, 48, 28, 39, 7, 89, 33, 26, 73, 90, 95, 36, 10, 47, 6, 69, 22, 4, 86, 44, 9, 93, 37, 84, 42, 99, 23, 77, 13, 70, 50]; const case1 = [...arr].sort( (a,b) => a - b).reverse();
sorting with reversive comparison
const arr = [ 83, 52, 100, 58, 20, 41, 53, 19, 27, 60, 91, 2, 29, 78, 45, 49, 56, 98, 35, 66, 63, 79, 3, 61, 75, 59, 71, 65, 34, 1, 81, 74, 30, 5, 97, 57, 62, 31, 92, 43, 16, 55, 32, 8, 46, 68, 40, 12, 87, 82, 80, 54, 96, 14, 94, 88, 72, 67, 24, 85, 76, 15, 18, 17, 64, 11, 51, 25, 38, 21, 48, 28, 39, 7, 89, 33, 26, 73, 90, 95, 36, 10, 47, 6, 69, 22, 4, 86, 44, 9, 93, 37, 84, 42, 99, 23, 77, 13, 70, 50]; const case2 = [...arr].sort( (a,b) => b - a);