-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Put panic code path from copy_from_slice
into cold function
#74512
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
Put panic code path from copy_from_slice
into cold function
#74512
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
7e6cbf3
to
af4bf0d
Compare
The x86 asm is shorter: https://rust.godbolt.org/z/53aodf |
af4bf0d
to
a0615e6
Compare
☔ The latest upstream changes (presumably #73265) made this pull request unmergeable. Please resolve the merge conflicts. |
a0615e6
to
b044ea1
Compare
☔ The latest upstream changes (presumably #75066) made this pull request unmergeable. Please resolve the merge conflicts. |
The previous `assert_eq` generated quite some code, which is especially problematic when this call is inlined. This commit also slightly improves the panic message from: assertion failed: `(left == right)` left: `3`, right: `2`: destination and source slices have different lengths ...to: source slice length (2) does not match destination slice length (3)
b044ea1
to
db99f98
Compare
Rebased. r? @KodrAus |
Nice! @bors r+ |
📌 Commit db99f98 has been approved by |
☀️ Test successful - checks-actions, checks-azure |
Final perf results are here. This was a small win across the board, mostly concentrated in incremental builds. Nice work! |
The previous
assert_eq
generated quite some code, which is especially problematic when this call is inlined. This commit also slightly improves the panic message from:...to:
You can see the code bloat in assembly here.