IList Sorting Performance Benchmarks¶
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 Cheatsheet¶
| 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.
Dataset Scenarios¶
- 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.
Windows (Editor/Player)¶
Last updated 2026-01-12 01:17 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.
Sorted¶
| List Size | Ghost | Meteor | Pattern-Defeating QuickSort | Grail | Power | Insertion | Tim | Jesse | Green | Ska | Ipn | Smooth | Block | IPS4o | Power+ | Glide | Flux |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 100 | 0.029 ms | 0.002 ms | 0.001 ms | 0.001 ms | 0.002 ms | 0.001 ms | 0.001 ms | 0.624 ms | 0.001 ms | 0.007 ms | 0.001 ms | 0.002 ms | 0.001 ms | 0.001 ms | 0.001 ms | 0.002 ms | 0.002 ms |
| 1,000 | 0.023 ms | 0.027 ms | 0.008 ms | 0.007 ms | 0.007 ms | 0.006 ms | 0.006 ms | 54.3 ms | 0.007 ms | 0.112 ms | 0.009 ms | 0.018 ms | 0.005 ms | 0.040 ms | 0.007 ms | 0.007 ms | 0.029 ms |
| 10,000 | 0.305 ms | 0.394 ms | 0.077 ms | 0.066 ms | 0.049 ms | 0.066 ms | 0.047 ms | 3.24 s | 0.071 ms | 1.45 ms | 0.083 ms | 0.175 ms | 0.056 ms | 0.571 ms | 0.048 ms | 0.048 ms | 0.386 ms |
| 100,000 | 3.51 ms | 5.14 ms | 0.764 ms | 0.658 ms | 0.469 ms | n/a | 0.459 ms | 136.86 s | 0.670 ms | 18.5 ms | 0.773 ms | 1.80 ms | 0.512 ms | 7.57 ms | 0.473 ms | 0.479 ms | 4.93 ms |
Nearly Sorted (2% swaps)¶
| 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.003 ms | 0.001 ms | 0.002 ms | 241 ms | 0.001 ms | 0.007 ms | 0.002 ms | 0.002 ms | 0.001 ms | 0.002 ms | 0.004 ms | 0.003 ms | 0.002 ms |
| 1,000 | 0.023 ms | 0.031 ms | 0.033 ms | 0.007 ms | 0.018 ms | 0.007 ms | 0.014 ms | 2.43 s | 0.007 ms | 0.100 ms | 0.030 ms | 0.018 ms | 0.007 ms | 0.045 ms | 0.025 ms | 0.016 ms | 0.030 ms |
| 10,000 | 0.293 ms | 0.395 ms | 0.443 ms | 0.073 ms | 0.232 ms | 0.063 ms | 0.173 ms | 23.44 s | 0.071 ms | 1.44 ms | 0.405 ms | 0.189 ms | 0.069 ms | 0.674 ms | 0.433 ms | 0.166 ms | 0.390 ms |
| 100,000 | 3.60 ms | 5.19 ms | 5.30 ms | 0.843 ms | 3.53 ms | n/a | 2.43 ms | 137.09 s | 0.727 ms | 18.8 ms | 4.98 ms | 1.95 ms | 0.633 ms | 8.46 ms | 5.37 ms | 2.28 ms | 4.96 ms |
Shuffled (deterministic)¶
| 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.007 ms | 0.006 ms | 0.007 ms | 0.008 ms | 0.017 ms | 0.011 ms | 61.7 ms | 0.008 ms | 0.011 ms | 0.008 ms | 0.012 ms | 0.005 ms | 0.006 ms | 0.025 ms | 0.012 ms | 0.007 ms |
| 1,000 | 0.156 ms | 0.132 ms | 0.088 ms | 0.105 ms | 0.152 ms | 1.49 ms | 0.160 ms | 216 ms | 0.121 ms | 0.133 ms | 0.097 ms | 0.200 ms | 0.089 ms | 0.107 ms | 0.434 ms | 0.159 ms | 0.098 ms |
| 10,000 | 2.50 ms | 1.95 ms | 1.22 ms | 1.46 ms | 1.49 ms | 147 ms | 1.57 ms | 669 ms | 1.38 ms | 1.78 ms | 1.33 ms | 2.76 ms | 1.20 ms | 1.57 ms | 5.98 ms | 1.80 ms | 1.44 ms |
| 100,000 | 31.9 ms | 26.0 ms | 15.3 ms | 18.2 ms | 18.3 ms | n/a | 20.4 ms | 2.21 s | 18.3 ms | 23.0 ms | 15.9 ms | 35.5 ms | 15.2 ms | 20.2 ms | 77.1 ms | 23.6 ms | 17.6 ms |
macOS¶
Pending — run the IList sorting benchmark suite on macOS to capture results.
Linux¶
Pending — run the IList sorting benchmark suite on Linux to capture results.
Other Platforms¶
Pending — run the IList sorting benchmark suite on the target platform to capture results.