-
Notifications
You must be signed in to change notification settings - Fork 13.7k
[DRAFT] Rc
: allow deduping both deref
and clone
across types
#133061
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
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
How does this relate to #132553? |
@Victoronz Oh, I didn't even know that existed. Well, taking a look, the difference is that it looks like the codegen test I added here wouldn't pass with that version of the PR, because that still keeps the different offsets from the counts to the value. So that one makes EDIT: updated the title and OP to help make that clearer. |
This comment has been minimized.
This comment has been minimized.
60ccc17
to
103ecd6
Compare
Rc
: store the pointer to the value, rather than to the allocationRc
: allow deduping both deref
and clone
across types
The job Click to see the possible cause of the failure (guessed by this bot)
|
@bors try |
[DRAFT] `Rc`: allow deduping both `deref` and `clone` across types This works by *always* putting the counts *just* before the value, rather than using an `RcInner` type at all. By doing that, the offset to the counts are exactly the same for all types -- small or large, low alignment or high -- so `Rc::clone` can be polymorphized, and `Rc::deref` is always just a no-op. r? ghost
☀️ Try build successful - checks-actions |
@rust-timer queue |
This comment has been minimized.
This comment has been minimized.
@rust-timer build 711b97b |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (711b97b): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowBenchmarking 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 Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary -3.0%, secondary 3.5%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (primary -0.5%, secondary 3.9%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeResults (primary -0.1%, secondary 7.4%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 788.599s -> 786.092s (-0.32%) |
I'm going to close this and hope that @EFanZh's version (see #132553 (comment)) will pick up anything useful that I had here -- realistically I don't think I'll get back to this anytime soon, and they've made a bunch of important progress in theirs (like fixing debug visualizers) that I never did here. |
This works by always putting the counts just before the value, rather than using an
RcInner
type at all.By doing that, the offset to the counts are exactly the same for all types -- small or large, low alignment or high -- so
Rc::clone
can be polymorphized, andRc::deref
is always just a no-op.r? ghost