1.13.1 — Find Her
This release is named after Easily Embarrassed's critically underrated Find Her, a great mix of bounce, crispy synths and glitchy sounds. It seems that I can't ever get bored of it.
I haven't taken the time to work a lot on cpp-sort lately, which called for at least a small release with the available bug fixes and quality of life changes. While remaining mostly a quality-of-life release, it eventually turned out to be bigger than expected, mostly due to the ongoing work the future version 2.0.0 of the library and the resulting refactors and backports.
The most notable changes are the algorithmic improvements mentioned in the corresponding section of this note, and the addition of a page explaining how to write a sorter adapter to the documentation.
Bug fixes
- Fix
iter_move
anditer_swap
when the library is compiled with C++20. The standard perimeter changed a bit in this area, and caused some ambiguous overload errors when the compiler couldn't decide which overload to pick between the standard library ones and thecppsort::utility::
ones. The standard library ones are now preferred for standard types when they exist. <cpp-sort/sorters/spreadsort/string_spread_sorter.h>
could not be included alone due to a missing include. This is now fixed.- Fix a bug where
make_projection_compare
failed to compile when passed an instance ofstd::identity
in C++20 mode. Introduced in version 1.13.0, this bug could cause issues when passingstd::identity
to sorters relying onsorter_facade
to provide projection support, such asstd_sorter
.// Error in 1.13.0, works in 1.13.1 cppsort::std_sort(collection, std::greater{}, std::identity{});
Improvements
Algorithmic & speed improvements:
- Update
heap_sort
from upstream (we use the libc++ implementation): the new implementations turns it into a bottom-up heapsort. It performs fewer comparisons than the previous implementation, which doesn't make a noticeable difference from a speed point of view when comparisons are cheap, but can be much more noticeable when comparisons are expensive. This new implementation can be slower in the expensive moves/cheap comparisons scenario.
- The fallback of
quick_merge_sort
for forward iterators when sorting just a few elements was changed from bubble sort to selection sort after I was reminded of the fact thatquick_merge_sort
was not a stable sort anyway and could therefore switch to a better unstable fallback algorithm for very small collections.
string_spread_sort
was changed to perform fewer projections, sometimes halving the total number of performed projections.
- The library's internal adaptive quickselect implementation was tweaked to perform fewer projections. As a result the following sorters perform up to 1% fewer projections when operating on random-access iterators:
- MSVC STL SIMD algorithms are now used when possible, which might marginally impact the following components for random-access iterators:
Improvements to sorting networks:
- All sorting networks used by
sorting_network_sorter
are now formally verified. - Regenerate all
sorting_network_sorter
specializations with the smallest networks from this list. The main resulting change is that sorting 25 inputs is now done with 130 compare-exchanges instead of 131. - All specializations of
sorting_network_sorter
now have theirindex_pairs()
function marked as[[nodiscard]]
when possible.
Other improvements:
- Total, weak and partial order comparators now support
__int128_t
and__uint128_t
. hybrid_adapter
is now fullyconstexpr
when the sorters it wraps are themselvesconstexpr
(#58).
Tooling
- Add a tutorial to the documentation explaining how to write a sorter adapter with a simple example (issue #154).
- Various smaller changes to improve the overall quality of the documentation.
- The required and downloaded Catch2 version is now v3.1.0.
- The
generate.py
from thetools
directory was changed by a more completegenerate_sorting_network.py
tool which formally verifies that a given sorting network works, then generates the correspondingsorting_network_sorter
. dist::as_long_string
in the benchmarking tools now inherits fromutility::projection_base
and itsoperator()
isconst
.- Continuous integration: update scripts to use actions/checkout v3.
- The configurations tested by the CI change depending on which tools are available in the CI environments.
Known bugs
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.