This page is for testing speeds of various sorting algorithms.

  • The code that makes the forms on this page is on the /code.js subpage.
  • The sorting algorithms themselves can be found at the github repo:
  • The sorting methods are all part of the SortingDemo global object, so you can access them from the console on this page. Ex.
// how long does Array.prototype.sort take versus SortingDemo.quickSort?
var d = SortingDemo.randomArray(50000, 100000);
var d2 = d.slice(); // copy the array
// sort d and print time
// sort d2 and print time
// verify that the arrays are in fact sorted

Speed Comparison DemoEdit

Quicksort Variants DemoEdit

Mergesort Variants DemoEdit