-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Optimize heapsort #93765
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
Optimize heapsort #93765
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @joshtriplett (or someone else) soon. Please see the contribution instructions for more information. |
Usually changes to sorting are benchmarked against a bunch of different data sets such already sorted, reverse-sorted, concatenation of two sorted etc. |
Create a benchmark suite. Compared the Benchmark script: https://gist.github.com/zhangyunhao116/1d40de341ba24462615d04ae21fcac81 Result:
|
@joshtriplett Kindly ping :) |
r? rust-lang/libs |
Triage: |
Could you prefer to rebase over merge? We have a no-merge policy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. Can you squash/rebase the commits? Thanks!
Done. PTAL, thanks! |
@bors r+ Thanks! |
📌 Commit 98507f2 has been approved by |
@bors rollup=never |
☀️ Test successful - checks-actions |
Finished benchmarking commit (5750a6a): comparison url. Instruction count
Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
rust-lang/rust#93765 shows a 10% speedup and had been merged into std. Given that rayon's code was an exact copy of the heapsort in std, this PR implements the same optimization.
950: Keep heapsorts implementation equal to std r=cuviper a=ritchie46 rust-lang/rust#93765 shows a 10% speedup and had been merged into std. Given that rayon's code was an exact copy of the heapsort in std, this PR implements the same optimization. Co-authored-by: Ritchie Vink <[email protected]>
The new implementation is about 10% faster than the previous one(sorting random 1000 items).