-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Reduce the range of elements sorted by partialsort #47191
Conversation
I may miss something, but this PR seems to be in a conflict with the original documentation, and thus breaking PartialQuickSort{T <: Union{Integer,OrdinalRange}}
Indicate that a sorting function should use the partial quick sort algorithm. Partial quick sort
returns the smallest k elements sorted from smallest to largest, finding them and sorting them using
QuickSort. |
That's probably why I overlooked it in the last PR. However, julia> partialsort(rand(1000), 500)
0.5000542824047202 I'll make the corresponding changes. |
Thanks. Shouldn't we also include the removed documentation for |
Co-authored-by: Petr Vana <[email protected]>
I'm not a huge fan of Is the undocumentation of a feature (provided it is still supported) something we can do before 2.0? |
Ok. Can we at least deprecate it if we remove the docs? Smth like this? @deprecate PartialQuickSort(k::Integer) PartialQuickSort(1:k) Results in this $ julia --depwarn=yes |
julia> import Base: PartialQuickSort
julia> @deprecate PartialQuickSort(k::Integer) PartialQuickSort(1:k)
PartialQuickSort
julia> PartialQuickSort(5)
┌ Warning: `PartialQuickSort(k::Integer)` is deprecated, use `PartialQuickSort(1:k)` instead.
│ caller = ip:0x0
└ @ Core :-1
PartialQuickSort{UnitRange{Int64}}(1:5)
|
I decided to do that separately because I think both PRs stand on their own and they have substantially different motivations. |
It took a few turns to get here, but I believe this PR is currently a simple performance improvement and the CI failures are unrelated.
|
If CI failures are really unrelated then the PR seems ready to be merged. |
Typically folks express that sentiment with an approving PR review, but a comment works too :) |
missing
means the end of the vector (e.g.PartialQuickSort(missing, missing) === QuickSort
). There is no need to sort the elementsbegin:k-1
forpartialsort(k)
.Fixup for #45222