Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Javascript Sort (numbers/strings)
Port from jsperf(https://jsperf.com/sorting-algorithms/58)
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:125.0) Gecko/20100101 Firefox/125.0
Browser:
Firefox 125
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
Built-in Sort (numbers)
1069.8 Ops/sec
Built-in Sort (strings)
56.2 Ops/sec
HTML Preparation code:
<script> function number_sort(ary) { return ary.sort(function(a, b) { return a - b; }); } function string_sort(ary) { return ary.sort(function(a, b) { return a.localeCompare(b); }); } </script>
Script Preparation code:
var numbers = []; for (var i = 0; i < 10000; i++) { numbers[i] = Math.round(Math.random() * 1000000); } var strings = []; for (var i = 0; i < 10000; i++) { strings[i] = Math.round(Math.random() * 1000000).toString(); }
Tests:
Built-in Sort (numbers)
number_sort(numbers.slice(0));
Built-in Sort (strings)
string_sort(strings.slice(0));