SotSort: a stable quicksort with a tunable buffer
Abstract
SotSort is a stable comparison sort whose single code path runs with anything from a fixed 16 KB buffer to a full n-element buffer. Its core is a stable quicksort that partitions blocks through the buffer and gathers them with rotations. This report summarises the design, states which parts are borrowed, and compares an implementation against blitsort, fluxsort, glidesort, driftsort, GrailSort and WikiSort. On one 2-vCPU machine, with 32- and 64-bit integers, the constant-memory mode takes between 0.32 and 0.82 of blitsort's time on 17 of 22 input classes and between 0.92 and 1.07 on the other five. With a comparator that rules out the vector partition it is slower than blitsort on 4 of 11 classes, by up to 2.3 times on sorted input. Against Virtual-Memory Powersort, on its authors' own harness and with the same auxiliary memory, the first measurement lost on most inputs; after three changes it located (one of them adopts that algorithm's paging scheme), SotSort is faster in 43 of 48 type and input combinations at n=106 on two machines. At n=107 on partially sorted integers it is between 7% faster and 7% slower depending on the machine, and on near-random input it is still slower: by 9% on integers at n=107, and by 5 to 17% at n=106 when comparisons are expensive. All numbers are preliminary.
Create a lesson
Metadata
- Comments
- 5 pages. v2: comparison with Virtual-Memory Powersort on its authors' harness, two machines. Code, tests and raw measurements: https://github.com/sotomayorlucas/sotsort
Recent in the same category
An n^{1/O(\log^* n)} Lower Bound for Online Coloring of k-Colorable Graphs
Recent in the same categorycs.DSSajad Faghfoor Maghrebi
Faster Directed SSSP on Digraphs with Random Sparse Supports or Few DFS Exceptions
Recent in the same categorycs.DSValery, Grishin, Aryeh Lev Zabokritskiy
Asymptotically Optimal Representation of Tree-Like Graphs
Recent in the same categorycs.DSJohannes Fischer
Randomized MST Certification beyond Cacti
Recent in the same categorycs.DSSina Ghasemi Nezhad
Exponential memory/query-complexity tradeoffs in high-accuracy feasibility problems
Recent in the same categorycs.DSJialin Yu, Moïse Blanchard
A Local-to-Global Approximation Framework for Covering Disjointness-Compliable Set Families
Recent in the same categorycs.DSJingyang Zhao, Mingyu Xiao