Applying sorting networks to synthesize optimized sorting libraries

Michael Codish, Luís Cruz-Filipe, Markus Nebel, Peter Schneider-Kamp

Research output: Chapter in Book/Report/Conference proceedingConference contributionpeer-review

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.

Original languageAmerican English
Title of host publicationLogic-Based Program Synthesis and Transformation - 25th International Symposium, LOPSTR 2015, Revised Selected Papers
EditorsMoreno Falaschi
PublisherSpringer Verlag
Pages127-142
Number of pages16
ISBN (Print)9783319274355
DOIs
StatePublished - 1 Jan 2015
Event25th International Symposium on Logic-Based Program Synthesis and Transformation, LOPSTR 2015 - Siena, Italy
Duration: 13 Jul 201515 Jul 2015

Publication series

NameLecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)
Volume9527

Conference

Conference25th International Symposium on Logic-Based Program Synthesis and Transformation, LOPSTR 2015
Country/TerritoryItaly
CitySiena
Period13/07/1515/07/15

All Science Journal Classification (ASJC) codes

  • Theoretical Computer Science
  • General Computer Science

Fingerprint

Dive into the research topics of 'Applying sorting networks to synthesize optimized sorting libraries'. Together they form a unique fingerprint.

Cite this