Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.9.0 #181

Merged
merged 90 commits into from Jan 30, 2021
Merged

Release 1.9.0 #181

merged 90 commits into from Jan 30, 2021

Conversation

Morwenn
Copy link
Owner

@Morwenn Morwenn commented Jan 30, 2021

No description provided.

This also fixes an issue in the "writing a sorter" tutorial that used
the pre-1.0.0 arguments order for cppsort::sort.
Wherever the library implements special handling of utility::identity,
provide the same level of support for std::identity when it is
available.
Add new C++20 category to describe the new support for std::identity,
std::ranges::less and std::ranges::greater.

Remove the section about how bitmap_allocator might be used and the text
about the relevance of the page across old versions. The embedding of
the documentation into the main repository made that text useless
(issue #157).

[ci skip]
Mostly small things that I noticed one working on the 2.0.0 branch,
which will undoubtly result in merge issues later, but these ought to be
fixed in 1.x.y anyway.
The bidirectional version of vergesort was modified as follows:
- It now uses the same k-way merge as the random-access version.
- It creates fewer partitions with one element, generally being smarter
  about which run an element should belong to.
- It spends less time recomputing runs sizes, leading to a lower impact
  on the running time overall.

The k-way merge algorithm is now shared between both versions and has
been tweaked to handle 1-element runs better. The in-code documentation
was also reworked to be more comprehensible and comprehensive. Some
variable names were changed to make the logic more obvious.
- The forward iterator version used utility::as_function without
properly qualifying it, which was a bug.
- The bidirectional version was updated with the "shrink on the left"
trick, which can both decrease the cost of the size computation and
reduce the number of elements to allocate.
First step to move the build to GitHub Actions: move the coverage
generation from Travis to Actions. It doesn't generate additional
information with lcov anymore, and now always runs on the latest
available Ubuntu.

[ci skip]
It is totally possible for nested wrapping of stable_adapter to happen,
this commit makes stable_adapter<stable_adapter<Sorter>> equivalent to
stable_adapter<Sorter>.
Declare that the result of std::mem_fn is branchless when it wraps a
pointer to data member. This is part of a wide library audit to make
pdqsort use its branchless partitioning algorithm more often. This
specific change uses standard library implementation-specific class
names, but it is quite important since as_function currently uses
std::mem_fn where it makes sense.
The following modifications were needed:
- Use the GitHub Action codecov/codecov-action
- Rename the workflow from codecov.yml to code-coverage.yml, otherwise
  the Codecov Action things it is the Codecov configuration file
- Change codecov.yml to ensure that the test files are not covered

[ci skip]
Cleanup the links and add information:
- Mention the 128-bit integers support for counting_sorter
- Mention the conditional std::mem_fn extended support
- Mention the condition improvements brought by assumptions

[ci skip]
The type alias stable_t is kind of a better equivalent to
stable_adapter: it aliases either a sorter directly if it is always
stable, otherwise stable_adapter<Sorter>::type if it exists, otherwise
stable_adapter<Sorter> itself. The goal is to alias the "least nested"
type that is always stable to decrease template instantiation, template
depth, and somehow bonary size. It also improves the error messages is
some cases.

Bundled with this feature: stable_adapter specializations now expose a
member type named 'type' to implement the mechanism described above.

The documentation page about sorters adapters was slightly cleaned up
and reworked as part of this change.
This change allows to use them with distributions. This commit also
takes advantage of this to change several parts of the test suite to use
distribution, and applies some drive-by cleanups.
Link to cppreference to make the doc more amenable. Also use the
lowercase concept name, and remove the duplicate "concept" word.

[ci skip]
[ci skip]
Drive-by fixes:
- Remove useless default template parameters
- std::move a projection in counting_adapter
indirect_adaper is implemented with mountain sort for random-access
iterator. This commits turns internal lambdas used for projections into
a proper named function object, and marks it as likely branchless when
the projection it wraps is likely branchless itself.
The lambda was a leftover from when ska_sort still relied on std::sort
as a fallback. Replacing it with std::less<> + the passed projection
means that pdqsort might use its branchless partition algorithm when it
makes sense.
Due to a copy-paste error, ska_sort did not work properly with signed
128-bit integers: it probably sorted signed and unsigned values
correctly, but not a mix of both.

This commit also uses std::uintptr_t when available instead of
std::size_t when sorting pointers, making it generally more correct.
This makes quick_merge_sort O(n log n) instead of O(n²) like it used to
be (the libc++ implementation of std::nth_element used until then was
quadratic).

The new implementation was taken from Danila Kutenin's miniselect
library.
Split swap_ranges calls into swap_ranges_inner and swap_ranges_overlap,
where the first has the "no overlap" guarantee and checks to ensure that
said guarantee holds.

This commit also adds an audit mechanism to cpp-sort for checks that
are too expensive for CPPSORT_ASSERT, and starts using it in
swap_ranges_inner to ensure that the "no overlap" guarantee holds.
This includes the following changes:
- Move it out of detail and in cpp-sort/comparators
- Get rid of its unused getters
- Make it conditionally branchless (#177)
- Make it a transparent comparator
- Document it

This commit includes a little cleanup of the corresponding documentation
page.
@Morwenn Morwenn merged commit ada4e8b into master Jan 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant