-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Inline Arc
and Rc
dealloc for T: !Drop
#97676
Conversation
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
r? @kennytm (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
Make `std::mem::needs_drop` accept `?Sized` This change attempts to make `needs_drop` work with types like `[u8]` and `str`. This enables code in types like `Arc<T>` that was not possible before, such as rust-lang#97676.
This avoids creating and calling `drop_slow` when all it does is decrement the weak count and potentially dealloc, which should not generate much code.
r? @thomcc |
This looks fine to me, but I'd like to see a perf run. @bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 5d0137e with merge 551fa756dcf11dc344f6bec4c58f2bb69f802765... |
☀️ Try build successful - checks-actions |
Queued 551fa756dcf11dc344f6bec4c58f2bb69f802765 with parent 21e9336, future comparison URL. |
Finished benchmarking commit (551fa756dcf11dc344f6bec4c58f2bb69f802765): 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. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Footnotes |
Make `std::mem::needs_drop` accept `?Sized` This change attempts to make `needs_drop` work with types like `[u8]` and `str`. This enables code in types like `Arc<T>` that was not possible before, such as rust-lang/rust#97676.
Given that this turned out to be a perf regression, I'm going to close. Let me know if you want to try more. |
Make `std::mem::needs_drop` accept `?Sized` This change attempts to make `needs_drop` work with types like `[u8]` and `str`. This enables code in types like `Arc<T>` that was not possible before, such as rust-lang/rust#97676.
Make `std::mem::needs_drop` accept `?Sized` This change attempts to make `needs_drop` work with types like `[u8]` and `str`. This enables code in types like `Arc<T>` that was not possible before, such as rust-lang/rust#97676.
Outline deallocation from Rc::drop since decrementing refcount usually is warmer Something similar was tried in rust-lang#97676 but let's see if letting PGO figure things out instead of being aggressive with the inline annotations leads to better results.
This avoids creating and calling
drop_slow
when all it does is decrement the weak count and potentially dealloc, which should not generate much code.This change applies to types like
Arc<str>
andArc<[u8]>
.