replace if with match in binary_search#106969
replace if with match in binary_search#106969a1393323447 wants to merge 3 commits intorust-lang:masterfrom
if with match in binary_search#106969Conversation
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @cuviper (or someone else) soon. Please see the contribution instructions for more information. |
|
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
It looks like they lined up starting with Rust 1.65, which is when we upgraded to LLVM 15. However, in the few benchmarks we have, there's a measurable regression here. Here's the merge-base commit 4781233, With your change: The benchmarks are pretty small, but these results are very consistent across multiple runs. (I'm running |
|
FWIW, getting I've got two related LLVM bugs open (llvm/llvm-project#59666 & llvm/llvm-project#60012), #105840 is trying to make Thus without a strong argument that the |
Now, the
matchversion generates pretty much the same assembly as theifversion. And I thinkmatchis more readable thanif. Here is the code: https://rust.godbolt.org/z/4vPc54hb7