scandum/blitsort logo

scandum/blitsort

Free

Blitsort is an in-place stable adaptive rotate mergesort / quicksort.

FreeFree tier
Type
Open Source

About scandum/blitsort

Blitsort is an in-place stable adaptive rotate mergesort/quicksort, implemented in C and designed for high performance sorting of arrays. It extends the concepts from the out-of-place stable merge sort quadsort, the stable quicksort fluxsort, and the unstable in-place crumsort. Blitsort uses a rotate merge sort approach: it partitions two sorted arrays until they are small enough to be merged using auxiliary memory, employing array rotations (via the efficient trinity rotation algorithm) and a monobound binary search for faster partitioning. The algorithm dynamically analyzes the input data distribution using the same analyzer as fluxsort: fully sorted or reverse-sorted data is handled immediately, mostly sorted data uses rotate quadsort, and random data uses rotate fluxsort (a stable rotate quicksort). By default, blitsort uses 512 elements of stack memory, but can be configured to use as few as 32 elements or sqrt(n) memory, plus O(log n) recursion depth. Performance is claimed to be about 15–50% faster than octosort (a block merge sort) and comparable to fluxsort when sufficient auxiliary memory is available.

Key Features

In-place stable sorting algorithm
Adaptive: handles sorted, reverse-sorted, and random data efficiently
Uses rotate merge sort and rotate stable quicksort techniques
Trinity rotation for significantly faster array rotations
Monobound binary search for up to 2x faster searching
Configurable memory usage: default 512 elements, minimum 32 elements, optional sqrt(n)
No external dependencies, written in C
Open source (MIT license implied by GitHub repository)

Pros & Cons

Pros
  • Faster than many existing in-place stable sorts (e.g., octosort) by 15–50%
  • Stable sort preserves original order of equal elements
  • Adaptive: near-linear performance on already sorted or reverse-sorted data
  • Low memory footprint (as low as 32 elements of stack memory)
  • Efficient array rotation using trinity rotation algorithm
Cons
  • Performance degrades on very large arrays (needs sqrt(n) memory for best performance)
  • Not a drop-in library for most programming ecosystems (C source code only)
  • Complex algorithmic implementation may be difficult to port or maintain
  • Lacks comprehensive documentation beyond GitHub README

Best For

Sorting large arrays when memory is limited (embedded systems, real-time systems)Applications requiring stable sort (preserving order of equal elements)Replacing slower in-place stable sorts in data processing pipelinesAcademic research and benchmarking of sorting algorithms

FAQ

What is the minimum memory requirement for Blitsort?
Blitsort can be configured to use as little as 32 elements of stack memory. By default it uses 512 elements.
How does Blitsort compare to octosort?
Blitsort is reported to be about 15–50% faster than octosort, a block merge sort.
Is Blitsort stable?
Yes, Blitsort is a stable sort, meaning it preserves the relative order of equal elements.
What algorithms does Blitsort combine?
Blitsort is based on quadsort (stable out-of-place mergesort), fluxsort (stable out-of-place quicksort), and crumsort (unstable in-place sort).