2
0
mirror of https://github.com/boostorg/sort.git synced 2026-01-19 04:42:11 +00:00
Files
sort/doc/constants.html
2015-01-13 21:56:11 -05:00

153 lines
8.8 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<link rel="stylesheet" type="text/css" href="../../../boost.css">
<title>Boost Sort library - Header &lt;boost/sort/spreadsort/sort.hpp&gt;</title>
</head>
<body link="#0000FF" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../index.htm"><img height="86" width="277" alt=
"C++ Boost" src="../../../boost.png" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost Sort library</h1>
<h2 align="center">Header &lt;boost/sort/spreadsort/constants.hpp&gt;</h2>
</td>
</tr>
</table>
<div class="spirit-nav">
<a accesskey="p" href="string_sort.html"><img src="../../../doc/html/images/prev.png" alt="Prev"/></a>
<a accesskey="u" href="index.html"><img src="../../../doc/html/images/up.png" alt="Up"/></a>
<a accesskey="h" href="index.html"><img src="../../../doc/html/images/home.png" alt="Home"/></a>
<a accesskey="n" href="rationale.html"><img src="../../../doc/html/images/next.png" alt="Next"/></a>
</div>
<hr/>
<h2>Contents</h2>
<dl class="page-index">
<dt><a href="#introduction">Introduction</a></dt>
<dt><a href="#constants">Constant Values</a></dt>
<dd>
<dl class="page-index">
<dt><a href="#max_splits">max_splits</a></dt>
<dt><a href="#max_finishing_splits">max_finishing_splits</a></dt>
<dt><a href="#min_sort_size">min_sort_size</a></dt>
<dt><a href="#int_log_mean_bin_size">int_log_mean_bin_size</a></dt>
<dt><a href="#int_log_min_split_count">int_log_min_split_count</a></dt>
<dt><a href="#int_log_finishing_count">int_log_finishing_count</a></dt>
<dt><a href="#float_log_mean_bin_size">float_log_mean_bin_size</a></dt>
<dt><a href="#float_log_min_split_count">float_log_min_split_count</a></dt>
<dt><a href="#float_log_finishing_count">float_log_finishing_count</a></dt>
</dl>
</dd>
</dl>
<hr>
<h2><a name="introduction" id="introduction"></a>Introduction</h2>
<p>These are a set of constants in boost::detail that are only used to tune
<a href="integer_sort.html">integer_sort</a> and <a href="float_sort.html">float_sort</a>.
They are described here because in some situations developers may wish to modify them
to improve performance. Default settings should be good enough for most systems;
modification without a thorough understanding of what they do is not recommended.</p>
<h2><a name="constants" id="constants"></a>Constant Values</h2>
<dt><a href="#max_splits">max_splits</a></dt>
<dt><a href="#max_finishing_splits">max_finishing_splits</a></dt>
<dt><a href="#min_sort_size">min_sort_size</a></dt>
<dt><a href="#int_log_mean_bin_size">int_log_mean_bin_size</a></dt>
<dt><a href="#int_log_min_split_count">int_log_min_split_count</a></dt>
<dt><a href="#int_log_finishing_count">int_log_finishing_count</a></dt>
<dt><a href="#float_log_mean_bin_size">float_log_mean_bin_size</a></dt>
<dt><a href="#float_log_min_split_count">float_log_min_split_count</a></dt>
<dt><a href="#float_log_finishing_count">float_log_finishing_count</a></dt>
<dl><a name="max_splits" id="max_splits"><b>max_splits</b>:</a>
<dt>enum { max_splits = 11 };</dt>
<dt><b>Description:</b> log base 2 of the maximum number of pieces the data is split into per iteration.
Usually best between 10 and 13.
This number is used for both floats and integers,
and should correspond to the minimum L1 cache size this software will run on.</dt></dl>
<dl><a name="max_finishing_splits" id="max_finishing_splits"><b>max_finishing_splits:</b></a>
<dt>enum { max_finishing_splits = max_splits + 1 };</dt>
<dt><b>Description:</b> log of the maximum number of pieces the data is split into if it can
complete sorting in one iteration, once radix sorting has already been decided upon.
This is a special optimization, and is usually best as max_splits + 1.
This is used because the occasional cache miss to finish sorting is less expensive
in runtime than running another iteration.</dt></dl>
<dl><a name="min_sort_size" id="min_sort_size"><b>min_sort_size:</b></a>
<dt>enum { min_sort_size = 3000 };</dt>
<dt><b>Description:</b> std::sort is automatically used on input vectors smaller than this size for all algorithms described here,
skipping radix sorting entirely. Due to overhead, radix sorting shouldn't be used on small
vectors. This should be the point at which
hybrid sorting becomes faster than comparison-based sorting.
3000 is a good value.</dt></dl>
<dl><a name="int_log_mean_bin_size" id="int_log_mean_bin_size"><b>int_log_mean_bin_size:</b></a>
<dt>enum { int_log_mean_bin_size = 2 };</dt>
<dt><b>Description:</b> The log of the minimum mean number of items per bin in <a href="integer_sort.html">integer_sort</a>.
2-4 are good values.</dt></dl>
<dl><a name="int_log_min_split_count" id="int_log_min_split_count"><b>int_log_min_split_count:</b></a>
<dt>enum { int_log_min_split_count = 9 };</dt>
<dt><b>Description:</b> This plus the int_log_mean_bin_size plus the maximum number of remaining
radix iterations is the log of the minimum number of elements to recurse with <a href="integer_sort.html">integer_sort</a>.
Otherwise std::sort is used.
The faster std::sort is with small vectors relative to <a href="integer_sort.html">integer_sort</a>, the larger this number
should be. 6 to max_splits are good values.
This value cannot exceed max_splits.</dt></dl>
<dl><a name="int_log_finishing_count" id="int_log_finishing_count"><b>int_log_finishing_count:</b></a>
<dt>enum { int_log_finishing_count = 31 };</dt>
<dt><b>Description:</b> The log of the threshold minimum data size to force radix sorting,
if sorting will complete in one iteration.
Defaults to 31, which means that this special-case is not applied.</dt></dl>
<dl><a name="float_log_mean_bin_size" id="float_log_mean_bin_size"><b>float_log_mean_bin_size:</b></a>
<dt>enum { int_log_mean_bin_size = 2 };</dt>
<dt><b>Description:</b> The log of the minimum mean number of items per bin in <a href="float_sort.html">float_sort</a>.
2 is a good value.</dt></dl>
<dl><a name="float_log_min_split_count" id="float_log_min_split_count"><b>float_log_min_split_count:</b></a>
<dt>enum { int_log_min_split_count = 8 };</dt>
<dt><b>Description:</b> This plus the float_log_mean_bin_size plus the maximum number of remaining
radix iterations is the log of the minimum number of elements to recurse with <a href="float_sort.html">float_sort</a>.
Otherwise std::sort is used.
The faster std::sort is with small vectors relative to <a href="float_sort.html">float_sort</a>, the larger this number
should be. 4 to max_splits are good values.
This value cannot exceed max_splits.</dt></dl>
<dl><a name="float_log_finishing_count" id="float_log_finishing_count"><b>float_log_finishing_count:</b></a>
<dt>enum { int_log_finishing_count = 4 };</dt>
<dt><b>Description:</b> The log of the threshold minimum data size to force radix sorting,
if sorting will complete in one iteration. 4 is a good value.</dt></dl>
<hr/>
<div class="spirit-nav">
<a accesskey="p" href="string_sort.html"><img src="../../../doc/html/images/prev.png" alt="Prev"/></a>
<a accesskey="u" href="index.html"><img src="../../../doc/html/images/up.png" alt="Up"/></a>
<a accesskey="h" href="index.html"><img src="../../../doc/html/images/home.png" alt="Home"/></a>
<a accesskey="n" href="rationale.html"><img src="../../../doc/html/images/next.png" alt="Next"/></a>
</div>
<p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
"http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional"
height="31" width="88"></a></p>
<p>Revised
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->04
December, 2006<!--webbot bot="Timestamp" endspan i-checksum="38514" --></p>
<p><i>Copyright &copy; 2009 <a href=
"mailto:spreadsort@gmail.com">Steven Ross</a></i></p>
<p><i>Distributed under the Boost Software License, Version 1.0. (See
accompanying file <a href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
copy at <a href=
"http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p>
</body>
</html>