Skip to content

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-05-08 04:05 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
1000.005 ms0.002 ms0.001 ms0.001 ms0.002 ms0.001 ms0.001 ms0.093 ms0.001 ms0.006 ms0.001 ms0.002 ms0.001 ms0.001 ms0.001 ms0.002 ms0.002 ms
1,0000.026 ms0.031 ms0.009 ms0.007 ms0.006 ms0.007 ms0.006 ms1.16 ms0.007 ms0.110 ms0.009 ms0.019 ms0.006 ms0.038 ms0.006 ms0.006 ms0.032 ms
10,0000.324 ms0.443 ms0.090 ms0.071 ms0.055 ms0.069 ms0.053 ms14.4 ms0.071 ms1.56 ms0.091 ms0.190 ms0.059 ms0.616 ms0.055 ms0.054 ms0.434 ms
100,0003.93 ms5.78 ms0.894 ms0.703 ms0.542 msn/a0.527 ms181 ms0.702 ms20.2 ms0.897 ms1.91 ms0.597 ms7.46 ms0.545 ms0.530 ms5.50 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
1000.002 ms0.002 ms0.002 ms0.001 ms0.002 ms0.001 ms0.002 ms0.099 ms0.001 ms0.006 ms0.002 ms0.002 ms0.001 ms0.002 ms0.002 ms0.002 ms0.002 ms
1,0000.026 ms0.031 ms0.037 ms0.009 ms0.019 ms0.008 ms0.015 ms1.20 ms0.007 ms0.110 ms0.034 ms0.019 ms0.008 ms0.047 ms0.025 ms0.016 ms0.034 ms
10,0000.326 ms0.444 ms0.508 ms0.081 ms0.258 ms0.071 ms0.192 ms14.1 ms0.078 ms1.57 ms0.466 ms0.198 ms0.079 ms0.721 ms0.403 ms0.181 ms0.440 ms
100,0003.99 ms5.88 ms6.07 ms0.820 ms4.06 msn/a2.75 ms189 ms0.802 ms20.3 ms5.74 ms1.96 ms0.720 ms8.66 ms5.75 ms2.43 ms5.58 ms

Shuffled (deterministic)

List Size Ghost Meteor Pattern-Defeating QuickSort Grail Power Insertion Tim Jesse Green Ska Ipn Smooth Block IPS4o Power+ Glide Flux
1000.010 ms0.008 ms0.006 ms0.007 ms0.008 ms0.018 ms0.011 ms0.041 ms0.008 ms0.009 ms0.008 ms0.011 ms0.005 ms0.006 ms0.023 ms0.012 ms0.008 ms
1,0000.167 ms0.137 ms0.096 ms0.107 ms0.111 ms1.67 ms0.159 ms0.442 ms0.117 ms0.139 ms0.104 ms0.200 ms0.092 ms0.109 ms0.432 ms0.172 ms0.105 ms
10,0002.32 ms2.00 ms1.30 ms1.48 ms1.55 ms166 ms1.67 ms5.46 ms1.46 ms1.90 ms1.39 ms2.89 ms1.27 ms1.63 ms5.95 ms1.94 ms1.49 ms
100,00033.6 ms26.4 ms16.2 ms18.8 ms18.9 msn/a21.8 ms68.2 ms18.9 ms24.0 ms17.0 ms36.9 ms15.8 ms20.1 ms79.3 ms26.2 ms18.8 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.