-
-
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
RFC: quicksort refactor, addition of selectperm #12303
Conversation
Nice. |
This looks great. Anything else need to be done? |
The docs for PartialQuickSort need to be updated (it can handle any OrdinalRange). I would also like to try only having PartialQuickSort take an OrdinalRange, but I'm not sure I'll get to that today. It shouldn't change any functionality, but it would simplify the code some. |
That could be done in a follow-on change, right? Seems better to do it separately then. |
👍 merge at will! |
* Break out select_pivot!, partition!, functions * Share these among different quicksort variants * Switch select to use PartialQuickSort
Thanks! Updated docs, squashed, and will merge when CI turns green again. I left @spencerlyon2's original commit in here. It passed CI previously, so I don't think it should be a problem. |
RFC: quicksort refactor, addition of selectperm
Thanks @kmsquire. Hopefully it isn't an issue! |
:-) |
This PR picks up where #10800 left off:
select_pivot!
andpartition!
from quicksortPartialQuickSort
(originally from @carlobaldassi)selectperm
,selectperm!
select
(andselect!
) to usePartialQuickSort
PartialQuickSort
here handles bothInt
andOrdinalRange
type parameters (which was not part of #10800).It could (and probably should) be changed to only handle
OrdinalRange
parameters, which would simplify the code (removing one extra function), at the cost of 1 extra comparison per (recursive) call.With limited testing, it seems that there are no performance regressions.
Cc: @spencerlyon2, @StefanKarpinski