Unity Helpers ships several custom sorting algorithms for IList<T> that cover different trade-offs between adaptability, allocation patterns, and stability. This page gathers context and benchmark snapshots so you can choose the right algorithm for your workload and compare results across operating systems.
| Algorithm | Stable? | Best For | Reference |
|---|---|---|---|
| Ghost Sort | No | Mixed workloads that benefit from adaptive gap sorting and few allocations | Upstream project by Will Stafford Parsons (public repository currently offline) |
| Meteor Sort | No | Almost-sorted data where gap shrinking beats plain insertion sort | Upstream project by Will Stafford Parsons (public repository currently offline) |
| Pattern-Defeating QuickSort | No | General-purpose quicksort with protections against worst-case inputs | pdqsort by Orson Peters |
| Grail Sort | Yes | Large datasets where stability + low allocations matter | GrailSort |
| Power Sort | Yes | Partially ordered data that benefits from adaptive run detection | PowerSort (Munro & Wild) |
| Tim Sort | Yes | General-purpose stable sorting with abundant natural runs | Wikipedia - Timsort |
| Jesse Sort | No | Data with long runs or duplicates where dual patience piles shine | JesseSort |
| Green Sort | Yes | Sustainable stable merges that trim ordered prefixes | greeNsort |
| Ska Sort | No | Branch-friendly partitioning on large unstable datasets | Ska Sort |
| Ipn Sort | No | In-place adaptive quicksort scenarios needing robust pivots | ipnsort write-up |
| Smooth Sort | No | Weak-heap hybrid that approaches O(n) for presorted data | Smoothsort - Wikipedia |
| Block Merge Sort | Yes | Stable merges with √n buffer (WikiSort style) | WikiSort |
| IPS⁴o Sort | No | Cache-aware samplesort with multiway partitioning | IPS⁴o paper |
| Power Sort Plus | Yes | Enhanced run-priority merges inspired by Wild & Nebel | PowerSort paper |
| Glide Sort | Yes | Stable galloping merges from the Rust glidesort research | sort-research-rs |
| Flux Sort | No | Dual-pivot quicksort tuned for modern CPUs | sort-research-rs |
| Insertion Sort | Yes | Tiny or nearly sorted collections where O(n²) is acceptable | Wikipedia - Insertion sort |
What does “stable” mean? Stable sorting algorithms preserve the relative order of elements that compare as equal. This matters when items carry secondary keys (e.g., sorting people by last name but keeping first-name order deterministic). Unstable algorithms can reshuffle equal entries, which is usually fine for numeric keys but can break deterministic pipelines.
Heads up: The original Ghost Sort repository was formerly hosted on GitHub under
wstaffordp/ghostsort, but it currently returns 404. The Unity Helpers implementation remains based on that source; we will relink if/when an official mirror returns.
- Sorted – ascending integers, verifying best-case behavior.
- Nearly Sorted (2% swaps) – deterministic neighbor swaps introduce light disorder to expose adaptive optimizations.
- Shuffled (deterministic) – Fisher–Yates shuffle using a fixed seed for reproducibility across runs and machines.
Each benchmark sorts a fresh copy of the dataset once and reports wall-clock duration. If a cell still shows pending, re-run the benchmark suite to collect fresh data for that algorithm/dataset size.
Run the IListSortingPerformanceTests.Benchmark test inside Unity’s Test Runner to refresh the tables below. Results automatically land in the section that matches the current operating system.
Last updated 2026-04-22 22:08 UTC on Windows 11 (10.0.26200) 64bit
Times are single-pass measurements in milliseconds (lower is better). n/a indicates the algorithm was skipped for the dataset size.
| List Size | Ghost | Meteor | Pattern-Defeating QuickSort | Grail | Power | Insertion | Tim | Jesse | Green | Ska | Ipn | Smooth | Block | IPS4o | Power+ | Glide | Flux |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 100 | 0.004 ms | 0.001 ms | 0.001 ms | 0.001 ms | 0.001 ms | 0.001 ms | 0.001 ms | 0.093 ms | 0.001 ms | 0.006 ms | 0.001 ms | 0.002 ms | 0.001 ms | 0.001 ms | 0.001 ms | 0.001 ms | 0.002 ms |
| 1,000 | 0.022 ms | 0.024 ms | 0.006 ms | 0.006 ms | 0.005 ms | 0.005 ms | 0.005 ms | 1.16 ms | 0.006 ms | 0.095 ms | 0.007 ms | 0.016 ms | 0.005 ms | 0.031 ms | 0.004 ms | 0.005 ms | 0.026 ms |
| 10,000 | 0.261 ms | 0.343 ms | 0.063 ms | 0.068 ms | 0.040 ms | 0.052 ms | 0.038 ms | 14.4 ms | 0.059 ms | 1.36 ms | 0.063 ms | 0.161 ms | 0.045 ms | 0.513 ms | 0.040 ms | 0.040 ms | 0.341 ms |
| 100,000 | 3.04 ms | 4.46 ms | 0.632 ms | 0.639 ms | 0.393 ms | n/a | 0.379 ms | 192 ms | 0.591 ms | 17.6 ms | 0.654 ms | 1.64 ms | 0.438 ms | 6.22 ms | 0.390 ms | 0.383 ms | 4.38 ms |
| List Size | Ghost | Meteor | Pattern-Defeating QuickSort | Grail | Power | Insertion | Tim | Jesse | Green | Ska | Ipn | Smooth | Block | IPS4o | Power+ | Glide | Flux |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 100 | 0.001 ms | 0.002 ms | 0.002 ms | 0.001 ms | 0.002 ms | 0.001 ms | 0.001 ms | 0.118 ms | 0.001 ms | 0.006 ms | 0.001 ms | 0.002 ms | 0.001 ms | 0.002 ms | 0.002 ms | 0.002 ms | 0.002 ms |
| 1,000 | 0.020 ms | 0.024 ms | 0.028 ms | 0.007 ms | 0.015 ms | 0.006 ms | 0.012 ms | 1.21 ms | 0.006 ms | 0.096 ms | 0.025 ms | 0.016 ms | 0.006 ms | 0.039 ms | 0.022 ms | 0.014 ms | 0.027 ms |
| 10,000 | 0.253 ms | 0.342 ms | 0.371 ms | 0.069 ms | 0.228 ms | 0.055 ms | 0.168 ms | 14.3 ms | 0.062 ms | 1.38 ms | 0.340 ms | 0.167 ms | 0.060 ms | 0.595 ms | 0.361 ms | 0.159 ms | 0.352 ms |
| 100,000 | 3.10 ms | 4.54 ms | 4.47 ms | 0.726 ms | 3.27 ms | n/a | 2.25 ms | 186 ms | 0.642 ms | 17.3 ms | 4.09 ms | 1.69 ms | 0.548 ms | 7.03 ms | 5.16 ms | 2.14 ms | 4.40 ms |
| List Size | Ghost | Meteor | Pattern-Defeating QuickSort | Grail | Power | Insertion | Tim | Jesse | Green | Ska | Ipn | Smooth | Block | IPS4o | Power+ | Glide | Flux |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 100 | 0.008 ms | 0.006 ms | 0.005 ms | 0.006 ms | 0.007 ms | 0.015 ms | 0.009 ms | 0.041 ms | 0.006 ms | 0.008 ms | 0.006 ms | 0.010 ms | 0.005 ms | 0.005 ms | 0.022 ms | 0.010 ms | 0.006 ms |
| 1,000 | 0.144 ms | 0.120 ms | 0.084 ms | 0.099 ms | 0.104 ms | 1.28 ms | 0.132 ms | 0.442 ms | 0.101 ms | 0.127 ms | 0.091 ms | 0.179 ms | 0.083 ms | 0.101 ms | 0.422 ms | 0.143 ms | 0.094 ms |
| 10,000 | 1.95 ms | 1.75 ms | 1.14 ms | 1.35 ms | 1.43 ms | 128 ms | 1.48 ms | 5.54 ms | 1.36 ms | 1.72 ms | 1.23 ms | 2.56 ms | 1.13 ms | 1.44 ms | 5.94 ms | 1.69 ms | 1.38 ms |
| 100,000 | 28.4 ms | 23.8 ms | 14.4 ms | 17.3 ms | 17.3 ms | n/a | 19.1 ms | 69.7 ms | 17.1 ms | 22.3 ms | 15.1 ms | 32.2 ms | 14.3 ms | 18.3 ms | 75.0 ms | 22.1 ms | 17.1 ms |
Pending — run the IList sorting benchmark suite on macOS to capture results.
Pending — run the IList sorting benchmark suite on Linux to capture results.
Pending — run the IList sorting benchmark suite on the target platform to capture results.