Morwenn/cpp-sort: 1.6.0 — Brunch
Description
I didn't have the opportunity to brunch properly since my trip to Scotland back in August where I could enjoy tasty local breakfasts at unreasonable hours - with today's excellent vegetarian brunch that cycle is complete and I can publish a new cpp-sort release.
New featuresA new spin_sorter has been added to the library, based on the algorithm from Boost.Sort. Spinsort is a stable mergesort derivative which is often faster than the other available stable sorting algorithms. It is a stable comparison sorting algorithm that runs in O(n log n) and requires O(n) additional memory; unlike other algorithms in the library it doesn't have a fallback when there isn't enough extra memory available to merge runs.
As can be seen in the benchmark result above (sorting a std::vector<long double> with 10^7 elements) it tends to be the fastest of the stable sorts for random data, and is otherwise adaptive when some presortedness exists in the data to sort.
- Fixed a long-standing out-of-bounds issue in
tim_sorter, which sometimes triggered Valgrind diagnostics when trying to sort anstd::deque(issue #89). - Fixed an ODR issue in
hybrid_adapterthat triggered a compile-time issue with Clang 9 (issue #158). - Fixed an unsigned integer overflow in
poplar_sorterthat triggered a diagnostic with the undefined behaviour sanitizer. - Fixed a
static_assertthat wasn't strict enough inverge_adapter.
- The library doesn't have naked
assertanymore: you now need to define the preprocessor flagCPPSORT_ENABLE_ASSERTIONSexplicitly in order to enable assertions. This flag still honours theNDEBUGmacro. - When
verge_sorteris used to sort bidirectional iterators, it now falls back toquick_merge_sorterinstead ofquick_sorterto sort sections of the data to sort where runs aren't big enough. This lowers the complexity from O(n²) to O(n log n log log n) with a worst case of O(log n log n) space - the complexity's worst case shifts from the fallback to the vergesort layer itself. The vergesort layer still uses O(n) memory when it finds patterns to optimize. counting_sorteris now able to sort collections of[un]signed __int128, even when the standard library is not properly instrumented to support them.- Algorithms relying on
uninitialized_movemay be faster when sorting trivial types. Affected sorters:block_sorter,merge_insertion_sorter,merge_sorter,spin_sorter,tim_sorterandverge_sorter. - Fewer copies of comparison and projection functions are performed when using stateful sorters.
There has been some overarching CMake and Conan cleanups for this release: cpp-sort is notably available on Conan Center now, and the built-in Conan support has been reduced and should only be used by people willing to package their own version of the library.
- cpp-sort can now be used as a CMake subproject with
add_subdirectorywithout triggering errors. - New CMake option
BUILD_EXAMPLES(OFFby default). - CMake: fixed flags in
Debugbuilds. - Examples are now built during CI to avoid breaking them and forgetting about them.
- The wiki now has a section dedicated to tooling, which currently contains some information about the CMake and Conan integration of the library.
- Improved test coverage for sorters that can handle forward and bidirectional iterators.
- Added tests to ensure that the library's algorithms marked as such can work even when no heap memory is available.
- Added tests for algorithms that special cases to handle int128.
I didn't manage to fix every bug I could find since the previous release, so you might want to check the list of known bugs.
Files
Morwenn/cpp-sort-1.6.0.zip
Files
(592.9 kB)
| Name | Size | Download all |
|---|---|---|
|
md5:c90c88e3f83f33ace3c1fb79b6b58210
|
592.9 kB | Preview Download |
Additional details
Related works
- Is supplement to
- https://github.com/Morwenn/cpp-sort/tree/1.6.0 (URL)