Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Versions of Quick Sort
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
Browser:
Chrome 128
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
quickSort
73333.4 Ops/sec
quickSort2
1485813.6 Ops/sec
Script Preparation code:
var array = [0, 213, 2, 55312, 322, 1312, 12311123, 54642 ]; function quickSort(arr){ if(arr.length <= 1) return arr const pivot = arr[arr.length - 1] let left = [] let right = [] for(let i = 0; i < arr.length-1; i++){ if (arr[i] < pivot) { left.push(arr[i]) } else { right.push(arr[i]) } } return [].concat(quickSort(left),pivot,quickSort(right)) } function quickSort2(arr){ if(arr.length <= 1) return arr const pivot = arr.pop() let left = [] let right = [] while(arr[0]){ if (arr[0] < pivot) { left.push(arr.shift()) } else { right.push(arr.shift()) } } return [].concat(quickSort(left),pivot,quickSort(right)) }
Tests:
quickSort
quickSort(array);
quickSort2
quickSort2(array);