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

Add par_sort_by_cached_key #932

Merged
merged 3 commits into from May 13, 2022
Merged

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented Apr 25, 2022

This is a port of the standard library's slice::sort_by_cached_key as ParallelSliceMut::par_sort_by_cached_key. We can do the initial key-caching indexed collect in parallel, and then use par_sort_unstable on that, but the final rearrangement on the original slice is still sequential.

The new benchmarks test integers with a to_string key, and it looks great on my Ryzen 7 5800X:

test sort::par_sort_by_cached_key   ... bench:   3,464,639 ns/iter (+/- 253,378) = 115 MB/s
test sort::par_sort_by_key          ... bench:   6,865,096 ns/iter (+/- 204,145) = 58 MB/s
test sort::par_sort_unstable_by_key ... bench:  13,346,235 ns/iter (+/- 1,966,048) = 29 MB/s

While I was in the neighborhood, I also updated documentation changes in the other sorting methods that were ported from the standard library.

@cuviper
Copy link
Member Author

cuviper commented May 13, 2022

bors r+

@bors bors bot merged commit 137be38 into rayon-rs:master May 13, 2022
@cuviper cuviper deleted the par_sort_by_cached_key branch February 25, 2023 17:58
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