Applying Sorting Networks to Synthesize Optimized Sorting Libraries
- Michael Codish,
- Luís Cruz-Filipe,
- Markus Nebel,
- Peter Schneider-Kamp
- Ben-Gurion University of the Negev,
- University of Southern Denmark
Research Output:
Journal Article or Conference Article in Journal
Conference article
Peer-reviewPublication Information
Output type
Research Output:
Journal Article or Conference Article in Journal
Conference article
Peer-reviewOriginal language
EnglishPages from-to (Number of pages)
Pages 127-142 (16 pages)Journal (Volume, Issue Number)
Lecture Notes in Computer SciencePublication milestones
- Published - 17/12/2015
Publication status
Published - 17/12/2015
Publication IDs
- Scopus: 84952801978
Abstract
This paper presents an application of the theory of sorting networks to facilitate the synthesis of optimized general-purpose sorting libraries. Standard sorting libraries are often based on combinations of the classic Quicksort algorithm with insertion sort applied as base case for small, fixed, numbers of inputs. Unrolling the code for the base case by ignoring loop conditions eliminates branching, resulting in code equivalent to a sorting network. This enables further program transformations based on sorting network optimizations, and eventually the synthesis of code from sorting networks. We show that, if considering the number of comparisons and swaps, the theory predicts no real advantage of this approach. However, significant speed-ups are obtained when taking advantage of instruction level parallelism and non-branching conditional assignment instructions, both of which are common in modern CPU architectures. We provide empirical evidence that using code synthesized from efficient sorting networks as the base case for Quicksort libraries results in significant real-world speed-ups.
Publication metrics
PlumX, opens in new tab
Captures
3
Citations
5
Access to documents
Related Event
Title
International Symposium on Logic-based Program Synthesis and Transformation
Event type
SymposiumDate
13/07/2015 - 15/07/2015Location
SienaItaly
