constants.hpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //constant definitions for the Boost Sort library
  2. // Copyright Steven J. Ross 2001 - 2014
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. // See http://www.boost.org/libs/sort for library home page.
  7. #ifndef BOOST_SORT_SPREADSORT_DETAIL_CONSTANTS
  8. #define BOOST_SORT_SPREADSORT_DETAIL_CONSTANTS
  9. namespace boost {
  10. namespace sort {
  11. namespace spreadsort {
  12. namespace detail {
  13. //Tuning constants
  14. //This should be tuned to your processor cache;
  15. //if you go too large you get cache misses on bins
  16. //The smaller this number, the less worst-case memory usage.
  17. //If too small, too many recursions slow down spreadsort
  18. enum { max_splits = 11,
  19. //It's better to have a few cache misses and finish sorting
  20. //than to run another iteration
  21. max_finishing_splits = max_splits + 1,
  22. //Sets the minimum number of items per bin.
  23. int_log_mean_bin_size = 2,
  24. //Used to force a comparison-based sorting for small bins, if it's faster.
  25. //Minimum value 1
  26. int_log_min_split_count = 9,
  27. //This is the minimum split count to use spreadsort when it will finish in one
  28. //iteration. Make this larger the faster boost::sort::pdqsort is relative to integer_sort.
  29. int_log_finishing_count = 31,
  30. //Sets the minimum number of items per bin for floating point.
  31. float_log_mean_bin_size = 2,
  32. //Used to force a comparison-based sorting for small bins, if it's faster.
  33. //Minimum value 1
  34. float_log_min_split_count = 8,
  35. //This is the minimum split count to use spreadsort when it will finish in one
  36. //iteration. Make this larger the faster boost::sort::pdqsort is relative to float_sort.
  37. float_log_finishing_count = 4,
  38. //There is a minimum size below which it is not worth using spreadsort
  39. min_sort_size = 1000 };
  40. }
  41. }
  42. }
  43. }
  44. #endif