Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions doc/bibliography.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
////
Copyright (c) 2017 Steven Ross, Francisco Tapia, Orson Peters
Distributed under the Boost Software License, Version 1.0
See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt
////

== Bibliography

=== Steven Ross

[discrete]
==== Standard Template Library Sort Algorithms

https://en.cppreference.com/w/cpp/algorithm/sort.html[C++ STL sort algorithms].

[discrete]
==== Radix Sort

A type of algorithm that sorts based upon distribution instead of by comparison.
Wikipedia has an article about Radix Sorting.
A more detailed description of various Radix Sorting algorithms is provided here:

Donald Knuth. The Art of Computer Programming,
Volume 3: Sorting and Searching, Second Edition. Addison-Wesley, 1998.
ISBN 0-201-89685-0. Section 5.2.5: Sorting by Distribution, pp.168-179.

[discrete]
==== Introsort

A high-speed comparison-based sorting algorithm that takes ['[bigo](N * log(N))] time.
See introsort and
Musser, David R. (1997). "Introspective Sorting and Selection Algorithms",
Software: Practice and Experience (Wiley) 27 (8), pp 983-993,
available at http://www.cs.rpi.edu/~musser/gp/introsort.ps[Musser Introsort].

[discrete]
==== American Flag Sort

A high-speed hybrid string sorting algorithm that string_sort is partially based
upon. See american_flag and Peter M. McIlroy, Keith Bostic, M. Douglas McIlroy. Engineering Radix Sort, Computing Systems 1993.

[discrete]
==== Adaptive Left Radix (ARL)

ARL (Adaptive Left Radix) is a hybrid cache-friendly integer sorting algorithm
with comparable speed on random data to integer_sort,
but does not have the optimizations for worst-case performance,
causing it to perform poorly on certain types of unevenly distributed data.

Arne Maus, http://www.nik.no/2002/Maus.pdf[ARL, a faster in-place, cache friendly sorting algorithm],
presented at NIK2002, Norwegian Informatics Conference, Kongsberg, 2002. Tapir, ISBN 82-91116-45-8.

[discrete]
==== Original Spreadsort

The algorithm that __integer_sort was originally based on.
__integer_sort uses a smaller number of key bits at a time for better cache efficiency
than the method described in the paper.
The importance of cache efficiency grew as CPU clock speeds increased
while main memory latency stagnated.
See Steven J. Ross,
The Spreadsort High-performance General-case Sorting Algorithm,
Parallel and Distributed Processing Techniques and Applications, Volume 3, pp.1100-1106. Las Vegas Nevada. 2002. See
[@../../doc/papers/original_spreadsort06_2002.pdf Steven Ross spreadsort_2002].

=== Francisco Tapia

. Introduction to Algorithms, 3rd Edition (Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein)
. C++ STL Sort Algorithms
. Algorithm + Data Structures = Programs ( Nicklaus Wirth) Prentice Hall Series in Automatic Computation
. Structured Parallel Programming: Patterns for Efficient Computation (Michael McCool, James Reinders, Arch Robison)

=== Orson Peters
35 changes: 35 additions & 0 deletions doc/gratitude.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
////
Copyright (c) 2017 Steven Ross, Francisco Tapia, Orson Peters
Distributed under the Boost Software License, Version 1.0
See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt
////

== Gratitude


=== Steven Ross

To Steve's wife Mary for her patience and support during the long process of converting spreadsort from a piece of C code to a template library.

To Phil Endecott and Frank Gennari for the improvements they've suggested and for testing.
Without them this would have taken longer to develop or performed worse.

To Scott McMurray for the fast and safe `float_mem_cast`.
That fix was critical for a high-performance cross-platform ``float_sort``.

To Paul A. Bristow for refactoring the initial documentation to use Quickbooks.

To Steven Watanabe, Edouard Alligand, and others in the boost community for their helpful suggestions.

=== Francisco Tapia

To http://www.cesvima.upm.es[CESVIMA], Centro de Cálculo de la Universidad Politécnica de Madrid.
When need machines for to tune this algorithm, I contacted with the investigation department of many Universities of Madrid. Only them, help me.

To Hartmut Kaiser, Adjunct Professor of Computer Science at Louisiana State University. By their faith in my work,

To Steven Ross, by their infinite patience in the long way in the develop of this algorithm, and their wise advises.

=== Orson Peters

61 changes: 61 additions & 0 deletions doc/introduction.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
////
Copyright (c) 2017 Steven Ross, Francisco Tapia, Orson Peters
Distributed under the Boost Software License, Version 1.0
See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt
////

:stem: latexmath

== Introduction

The goal of the Boost Sort Library is provide to the users, the most modern, fast, and memory-efficient sorting algorithms.

This library provides stable and unstable sorting algorithms, in single threaded and parallel versions.

These algorithms do not use any other library or utility, you only need to include ``boost/sort/sort.hpp``
or one of the more specific headers. The parallel algorithms need a C++11 compliant compiler.

=== Single Thread Algorithms

[cols="1,1,1,1,1,1,1"]
|===
| Algorithm | Stable | Additional memory | Best case | Average case | Worst case | Method

| <<spreadsort>> | no | key_length | stem:[n] | stem:[n \sqrt {\log n}] | min(stem:[n \log n], N key_length) | Hybrid radix sort
| pdqsort | no | stem:[\log n] | stem:[n] | stem:[n \log n] | stem:[n \log n] | Comparison operator
| spinsort | yes | stem:[n/2] | stem:[n] | stem:[n \log n] | stem:[n \log n] | Comparison operator
| flat_stable_sort | yes | size of the data / 256 + 8K | stem:[n] | stem:[n \log n] | stem:[n \log n] | Comparison operator
|===

* <<spreadsort>> is an extremely fast hybrid https://en.wikipedia.org/wiki/Radix_sort[Radix Sort] algorithm, designed and developed by Steven Ross.
* _pdqsort_ is a improvement of https://en.wikipedia.org/wiki/Quicksort[Quicksort] algorithm, designed and developed by Orson Peters.
* _spinsort_ is a https://en.wikipedia.org/wiki/Sorting_algorithm#Stability[stable] sort that is fast with random or nearly sorted data,
designed and developed by Francisco Tapia.
* _flat_stable_sort_ is a stable sort that uses very little additional memory (around 1% of the size of the data), providing 80% - 90% of the speed of
spinsort, designed and developed by Francisco Tapia.

=== Parallel Algorithms

[cols="1,1,1,1,1,1"]
|===
| Algorithm | Stable | Additional memory | Best case | Average case | Worst case

| sample_sort | yes | stem:[n] | stem:[n] | stem:[n \log n] | stem:[n \log n]
| parallel_stable_sort | yes | stem:[n/2] | stem:[n] | stem:[n \log n] | stem:[n \log n]
| block_indirect_sort | no | block_size * num_threads | stem:[n] | stem:[n \log n] | stem:[n \log n]
|===

* _Sample_sort_ is a implementation of the https://en.wikipedia.org/wiki/Samplesort[Samplesort] algorithm done by Francisco Tapia.
* _Parallel_stable_sort_ is based on the samplesort algorithm, but using a half of the memory used by sample_sort, conceived and implemented by Francisco Tapia.
* _Block_indirect_sort_ is a novel high-speed parallel sort algorithm with low additional memory consumption, conceived and implemented by Francisco Tapia.

The *block_size* is an internal parameter of the algorithm, which in order to achieve the
highest speed, changes according to the size of the objects to sort according to the next table. The strings use a block_size of 128.

[cols="1,1,1,1,1,1,1,1"]
|===

| *object size (bytes)* | 1 - 15 | 16 - 31 | 32 - 63 | 64 - 127|128 - 255|256 - 511| 512 -
| *block_size (number of elements)* | 4096 | 2048 | 1024 | 768 | 512 | 256 | 128
|===
34 changes: 34 additions & 0 deletions doc/single_thread.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
////
Copyright (c) 2017 Steven Ross, Francisco Tapia, Orson Peters
Distributed under the Boost Software License, Version 1.0
See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt
////

== Single Thread Algorithms

=== Overview

[cols="1,1,1,1,1,1,1"]
|===
| Algorithm | Stable | Additional memory | Best case | Average case | Worst case | Method

| <<spreadsort>> | no | key_length | stem:[n] | stem:[n \sqrt {\log n}] | min(stem:[n \log n], N key_length) | Hybrid radix sort
| pdqsort | no | stem:[\log n] | stem:[n] | stem:[n \log n] | stem:[n \log n] | Comparison operator
| spinsort | yes | stem:[n/2] | stem:[n] | stem:[n \log n] | stem:[n \log n] | Comparison operator
| flat_stable_sort | yes | size of the data / 256 + 8K | stem:[n] | stem:[n \log n] | stem:[n \log n] | Comparison operator
|===

* <<spreadsort>> is an extremely fast hybrid https://en.wikipedia.org/wiki/Radix_sort[Radix Sort] algorithm, designed and developed by Steven Ross.
* _pdqsort_ is a improvement of https://en.wikipedia.org/wiki/Quicksort[Quicksort] algorithm, designed and developed by Orson Peters.
* _spinsort_ is a https://en.wikipedia.org/wiki/Sorting_algorithm#Stability[stable] sort that is fast with random or nearly sorted data,
designed and developed by Francisco Tapia.
* _flat_stable_sort_ is a stable sort that uses very little additional memory (around 1% of the size of the data), providing 80% - 90% of the speed of
spinsort, designed and developed by Francisco Tapia.

include::spreadsort.adoc[]
// include::pdqsort.adoc[]
// include::spinsort.adoc[]
// include::flat_stable_sort.adoc[]
// include::linux_single.adoc[]
// include::windows_single.adoc[]
28 changes: 28 additions & 0 deletions doc/sort.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
////
[library Boost.Sort
[quickbook 1.7]
[id sort]
[copyright 2014-2017 Steven Ross, Francisco Tapia, Orson Peters]
[authors [Ross, Steven] [Tapia, Francisco] [Peters, Orson]]
[dirname sort]
[license Distributed under the
[@http://boost.org/LICENSE_1_0.txt Boost Software License, Version 1.0].
]
]
////

= Boost.Sort
Steven Ross, Francisco Tapia, Orson Peters
:toc: left
:toclevels: 5
:toc-title: Boost.Sort
:sectnums:
:sectnumlevels: 4

include::introduction.adoc[]
include::single_thread.adoc[]

// [include parallel.qbk]

include::bibliography.adoc[]
include::gratitude.adoc[]
Loading