Skip to content

weissan/BlockQuicksort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BlockQuicksort

Code of BlockQuicksort and other algorithms tested in the paper "BlockQuicksort: Avoiding Branch Mispredictions in Quicksort" by Stefan Edelkamp and Armin Weiß (available at https://dl.acm.org/doi/10.1145/3274660, conference version at ESA 2016 https://drops.dagstuhl.de/opus/volltexte/2016/6389/, preprint on arXiv under the title "BlockQuicksort: How Branch Mispredictions don't affect Quicksort" http://arxiv.org/abs/1604.06697).

This package consists of the following files:

  • makefile

  • driver.cpp : generates test cases and runs the sorting algorithms

  • quicksort.h : contains different Quicksort main loops

  • partition.h : contains different versions of the block partitioner and other partitioners

  • median.h : functions for choosing pivot elements

  • insertionsort.h : copy of insertion_sort from the GCC 4.7.2 implementation of std::sort

  • interfaces for BlockQuicksort with different pivot selection methods / partitioners: blocked.h++, blocked_double_pivot_check.h++, blocked_double_pivot_check_mosqrt.h++, blocked_hoare_finish.h++, blocked_mo3_mo3.h++, blocked_mo3_mo5.h++, blocked_mo5_mo5.h++, blocked_Mo5.h++, blocked_mo23.h++, blocked_mosqrt.h++, blocked_simple.h++, hoare.h++

The method blocked_double_pivot_check_mosqrt.h++ performed in all benchmarks close to the optimum and therefore is shown in most plots in the paper. For comparison also the method blocked_simple.h++ is shown in most plots in the paper.

How to build single programs

Build a single algorithm can be done through:

	make build ALGNAME="algorithm_name"

Build a single algorithm with a custom type:

	make build ALGNAME="algorithm_name" TYPE="custom_type"	

#How to run

Run single programs

	./a.out input_size distribution_type seed

distribution_type is given by 1 letter, see driver.cpp for further details, it has quite a few!.

Run tests

There are quite a few testing methods, I encourage you to go exploring yourself, however the most notable are listed below.

newtimetest

Runs all algorithms with the permutations defined in the variable: newsmalldata. We tested with the variable existingsmalldata

make newtimetest

timetest

Existing method we do not implement. Runs a lot of tests with different types and permutations, takes a while!

make timetest

perftimetest

Runs the perf state command on all algorithms, on all input sizes with random permutation. Used to see instructions count, branches and branch misses.

make perftimetest

newblocksizetest

Runs blocksize tests on both blocked and multi-pivot blocked algorithms.

make newblocksizetest

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published