TimSorter
import "std/core" (included in import "std") · namespace std.core
The sorting algorithm behind Sort and Array.sortBy: TimSort, a stable, adaptive merge sort. It runs in O(n log n) time in the worst case and close to O(n) on input that is already mostly sorted. It works directly on a raw buffer (T*), so you normally use it through Sort or Array.sortBy rather than directly.
API
class TimSorter<T>
Constructors
new TimSorter(a: T*, n: int, cmp: fn(T, T) -> int)
Methods
fn sort()— Sorts the elements in place.