ENH: implement powersort merge-policy for argsort #29751
Merged
+15
−53
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request follows up on the previous accepted pull request for numeric inplace sorting. Here we bring Powersort for numeric argsort as well.
On the same sample data as before, we analyzed the improvement of Powersort over Timsort, both for the existing inplace-sorting as well as for argsort. The improvement for argsort is slightly weaker but more concentrated. Slow instances show the biggest change: for the biggest quartile, Timsort on average is 10.7% slower for inplace sorting and 5.7% for argsorting.
For both Timsort and Powersort, argsort is consistently slower than inplace-sorting, by an average factor of 1.80 and 1.84 respectively. This behavior was also already suggested in the review to the last pull request. It is also a likely explanation for the weaker yet more concentrated improvement, as the merge order has less share of the overall computation due to the additional level of indirection.