Most computer programming languages provide built-in standard sorting algorithms. Let’s compare performance of these.
The above graph shows performance of the standard C++ STL sort algorithm. The vertical axis is time measured in seconds. The horizontal axis is array size of integers (32-bits each). Signed 32-bit integer values in the array are random with a uniform distribution. Performance measurements were done on an Intel i5-6300HQ quad-core laptop processor. This algorithm is non-parallel – used a single core out of the four available cores in this processor. For instance, it took C++ STL sort algorithm about 14 seconds to sort an array of 100 Million 32-bit integers. Standard C++ STL sort is able to sort 7.1 Million 32-bit integers per second.
C# provides standard sorting algorithms. The graph below shows performance of C# sort on the Intel i5-6300HQ quad-core laptop processor:
Python 2.7.12 (Anaconda 4.1.1 64-bit) and Python 3.6 provide a standard sorting algorithm using Timsort. The graph below shows performance of Python sort on the Intel i5-6300HQ quad-core laptop processor:
Putting All Together
The following graph compares performance of standard built-in sorting algorithms of several popular computer languages above. Run-time in seconds is on the vertical axis, with array size of 32-bit integers on the horizontal axis.
Interactive version of the above graph is at the below link, where individual points are visible, full-screen view is available and individual graphs can be highlighted
More Sorting Algorithms
To explore variety of sorting algorithms follow the link below: