Glidesort performance characteristics
masterGlidesort is a stable, deterministic, comparison-based sort. For sorting n elements with k distinct values, its complexity is:
| Case | Complexity |
|---|---|
| Best | n |
| Average | n log k |
| Worst | n log n |
| Memory | n / 8 (default) |
Memory Management:
By default, Glidesort allocates up to n elements worth of data. It scales this down if it exceeds 1 MiB (to n / 2) or 1 GiB (to n / 8). If provided with O(1) memory, the average and worst cases become O(n (log n)^2), though performance remains good for most data sizes.