JavaScript Sorting Algorithms

I had the privilege of attending jsDay last week in Verona, Italy. One of my favorite talks during the two-day event was titled “CS101 Intro to Computational Complexity: The Sorting Problem” by Claudia Hernández.

When calling Array.prototype.sort(), I (as I suspect many of you) had no idea exactly what the magicians under-the-hood were doing with my array. All I knew was that if I didn’t pass proper instructions to the method, I didn’t always get back the results I was expecting.

The crux of the talk revolved around the various different sorting algorithms that each of the major browser vendors use (MergeSort, QuickSort, and InsertionSort) for the native .sort() method and how each of those algorithms perform under various different conditions (sorting an array of 10 items, 100 items, etc. up to 10 million items).

I highly recommend taking a look through the slides. I’ll be sure to update this post if/when a video of the talk becomes available.

Have a question, comment, or concern? Please feel free to open an issue on GitHub.