[/===========================================================================
 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
=============================================================================/]

[section:linux_single 2.5.- Linux Benchmarks]


This library contains a benchmark folder with programs to measure the speed of the algorithms on your machine and operating system.
These are short benchmarks to test speed with different kinds of data ( random, sorted, sorted plus unsorted append at end ...)

This was run on a Intel(R) Core(TM) i7-5820K CPU @ 3.30GHz, with 6 cores and 2 threads by core, and 15M of cache

The results obtained with GCC 6.3 on Linux, in the benchmark_numbers with integers are:

[section:near_sorted Near Sorted Data]
[:
[h4[_Near Sorted Data With 100 000 000 64 bits Integers]]

benchmark/single/benchmark_numbers.cpp : This benchmark shows the results obtained with several kind of integers numbers (random, and near
sorted).

The benchmarks with strings and objects of different sizes are not showed here, but you can obtain running the benchmark_strings.cpp ans benchmarks_objects.cpp programs.


[*[teletype]
``
                                |           |           |           |           |           |           |
                                |           |           |std::      |           |flat_      |           |
                                | std::sort | pdqsort   |stable_sort| spinsort  |stable_sort|spreadsort |
    ----------------------------+-----------+-----------+-----------+-----------+-----------+-----------+
    random                      |   8.21    |   3.99    |   8.62    |   9.73    |  10.80    |   4.26    |
                                |           |           |           |           |           |           |
    sorted                      |   1.84    |   0.13    |   4.88    |   0.06    |   0.07    |   0.06    |
    sorted + 0.1% end           |   6.41    |   2.91    |   4.92    |   0.41    |   0.36    |   3.16    |
    sorted +   1% end           |  14.15    |   3.39    |   4.97    |   0.55    |   0.49    |   3.65    |
    sorted +  10% end           |   6.72    |   4.15    |   5.73    |   1.32    |   1.40    |   4.39    |
                                |           |           |           |           |           |           |
    sorted + 0.1% middle        |   4.41    |   3.31    |   6.58    |   1.89    |   2.61    |   3.29    |
    sorted +   1% middle        |   4.39    |   3.62    |   7.06    |   2.12    |   3.07    |   3.80    |
    sorted +  10% middle        |   6.35    |   4.71    |   9.56    |   4.02    |   5.49    |   4.99    |
                                |           |           |           |           |           |           |
    reverse sorted              |   1.36    |   0.26    |   5.12    |   0.13    |   0.14    |   1.87    |
    reverse sorted + 0.1% end   |   7.57    |   2.92    |   5.22    |   0.52    |   0.42    |   2.83    |
    reverse sorted +   1% end   |   4.99    |   3.33    |   5.29    |   0.66    |   0.55    |   3.45    |
    reverse sorted +  10% end   |   4.62    |   4.16    |   6.03    |   1.45    |   1.44    |   4.35    |
                                |           |           |           |           |           |           |
    reverse sorted + 0.1% middle|   4.38    |   3.29    |   6.52    |   1.89    |   2.54    |   3.28    |
    reverse sorted +   1% middle|   4.43    |   3.65    |   7.09    |   2.12    |   3.09    |   3.81    |
    reverse sorted +  10% middle|   6.42    |   4.70    |   9.46    |   4.02    |   5.53    |   5.00    |
                                |           |           |           |           |           |           |

``
]
]
[endsect]

[section:complex_benchmarks Complex (Several Types)]
[:
The next results  are obtained from more complex benchmarks, not include in the library because they use non free software
(If you are interested in their code, contact fjtapia@gmail.com)

There are 3 types of benchmarks,
[:
*64 bits integers

*strings

*objects of several sizes.

The objects are arrays of integers.  The heavy comparison sums all the elements in each, and the light comparison uses only the first number of the array.

]



[h4[_100 000 000 Numbers of 64 bits Randomly Filled]]


[*[teletype]
``
                        |         |             |
                        |  Time   |   Maximum   |
                        |  secs   | Memory Used |
    --------------------+---------+-------------+
     std::sort          |  8.2154 |     784 MB  |
     pdqsort            |  3.9356 |     784 MB  |
                        |         |             |
     std::stable_sort   |  8.5016 |    1176 MB  |
     spinsort           |  9.4262 |    1175 MB  |
     flat_stable_sort   | 10.6790 |     788 MB  |
     spreadsort         |  4.2248 |     785 MB  |
                        |         |             |

``
]
[h4[_10 000 000  Strings Randomly Filled]]

[*[teletype]
``
                        |         |             |
                        |  Time   |   Maximum   |
                        |  secs   | Memory Used |
    --------------------+---------+-------------+
     std::sort          |  6.2442 |    822 MB   |
     pdqsort            |  6.6661 |    821 MB   |
                        |         |             |
     std::stable_sort   | 12.2620 |   1134 MB   |
     spinsort           |  8.5996 |    978 MB   |
     flat_stable_sort   |  9.2559 |    978 MB   |
     spreadsort         |  2.4323 |    822 MB   |
                        |         |             |
``
]
[h4[_Objects Randomly Filled]]
[:
The objects are arrays of 64 bits numbers

They are compared in two ways :
[:
     (H) Heavy : The comparison is the sum of all the numbers of the array.

     (L) Light : The comparison is using only the first element of the array,
                 as a key
]
]

[*[teletype]
``
                     |           |           |           |           |           |           |             |
                     | 100000000 |  50000000 |  25000000 |  12500000 |   6250000 |   1562500 |             |
                     | objects of| objects of| objects of| objects of| objects of| objects of|   Maximum   |
                     |  8 bytes  | 16 bytes  | 32 bytes  | 64 bytes  | 128 bytes | 512 bytes |   Memory    |
                     |           |           |           |           |           |           |   Used      |
                     |  H     L  |  H     L  |  H     L  |  H     L  |  H     L  |  H     L  |             |
    -----------------+-----------+-----------+-----------+-----------+-----------+-----------+-------------+
    std::sort        | 8.25  8.26| 4.46  4.23| 2.67  2.33| 2.10  1.45| 1.72  1.11| 1.13  0.76|    786 MB   |
    pdqsort          | 8.17  8.17| 4.42  4.11| 2.57  2.26| 1.78  1.37| 1.46  1.06| 0.97  0.70|    786 MB   |
                     |           |           |           |           |           |           |             |
    std::stable_sort |10.28 10.25| 5.57  5.24| 3.68  3.26| 2.97  2.59| 2.60  2.46| 2.38  2.29|   1177 MB   |
    spinsort         | 9.70  9.69| 5.25  4.89| 3.28  2.65| 2.41  1.92| 2.03  1.66| 1.66  1.52|   1176 MB   |
    flat_stable_sort |10.75 10.73| 6.44  5.99| 4.36  3.71| 3.59  2.86| 3.04  2.11| 1.64  1.45|    789 MB   |
    spreadsort       | 5.10  5.10| 3.79  4.18| 2.22  1.88| 1.58  1.11| 1.51  0.99| 0.74  0.53|    786 MB   |
                     |           |           |           |           |           |           |             |


``
]
]
[endsect]
[endsect]
