Sort Sorted Array

JavaScript performance comparison

Test case created by Joshua

Info

How much faster does javascript sort an already sorted array.

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    mkArray = function () { return [1,4,3,5,2,3,67,45,78,32,4,57,3,4,6]; }
    a1 = mkArray().sort();
};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Sort new Array
mkArray().sort();
pending…
Sort existing array
a1.sort()
pending…

You can edit these tests or add even more tests to this page by appending /edit to the URL.

Compare results of other browsers

0 comments

Add a comment