Skip to content
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

Avoid cloning refcounted types during folding #91353

Merged
merged 1 commit into from
Dec 13, 2021

Conversation

eggyal
Copy link
Contributor

@eggyal eggyal commented Nov 29, 2021

Addresses FIXME comment created in #78313

r? @lcnr

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 29, 2021
@lcnr
Copy link
Contributor

lcnr commented Nov 29, 2021

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 29, 2021
@bors
Copy link
Contributor

bors commented Nov 29, 2021

⌛ Trying commit 7e56cba8813a2b42dc593680b9c1c3b1c73495fc with merge e4a148d67d908f3377edf425472464853ddecbad...

@bors
Copy link
Contributor

bors commented Nov 29, 2021

☀️ Try build successful - checks-actions
Build commit: e4a148d67d908f3377edf425472464853ddecbad (e4a148d67d908f3377edf425472464853ddecbad)

@rust-timer
Copy link
Collaborator

Queued e4a148d67d908f3377edf425472464853ddecbad with parent 44723c5, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e4a148d67d908f3377edf425472464853ddecbad): comparison url.

Summary: This benchmark run did not return any relevant changes.

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 led to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 29, 2021
@apiraino apiraino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Dec 1, 2021
@lcnr
Copy link
Contributor

lcnr commented Dec 9, 2021

afaik Rc and Arc are really rarely used. I think that ideally we would avoid the copy of the inner data (which is actually the costly) part, but that requires some more complex (and probably unsafe) changes, so I am fine with this as is

@bors delegate+

@lcnr

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Dec 9, 2021

✌️ @eggyal can now approve this pull request

@eggyal eggyal force-pushed the reuse-rcs-during-folding branch 2 times, most recently from f5b70fa to 8aea3c5 Compare December 9, 2021 18:28
@eggyal
Copy link
Contributor Author

eggyal commented Dec 9, 2021

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Insufficient permissions to issue commands to rust-timer.

@bors
Copy link
Contributor

bors commented Dec 9, 2021

⌛ Trying commit 8aea3c54f92c39f74961ccb9c1a9df41abd0e060 with merge 61c0f6be8fa61b1982ad10d83cd8c32f4ea25e77...

@eggyal
Copy link
Contributor Author

eggyal commented Dec 9, 2021

I think that ideally we would avoid the copy of the inner data (which is actually the costly) part, but that requires some more complex (and probably unsafe) changes, so I am fine with this as is

I've pushed a version that avoids those clones if possible. Can you request that rust-timer do a perf-run? Then obvs will need a thorough review. Or else am happy to roll back to the previous version.

@rust-log-analyzer

This comment has been minimized.

@eggyal eggyal changed the title Reuse refcounted allocs during folding Avoid cloning refcounted types during folding Dec 9, 2021
@lcnr
Copy link
Contributor

lcnr commented Dec 10, 2021

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 10, 2021
@bors
Copy link
Contributor

bors commented Dec 10, 2021

⌛ Trying commit 2581670e9a9c7071de095dc5ec85165e9d108cb8 with merge 4f6356ed89d4f4988faf7d95a399ff6669718e4a...

@bors
Copy link
Contributor

bors commented Dec 10, 2021

☀️ Try build successful - checks-actions
Build commit: 4f6356ed89d4f4988faf7d95a399ff6669718e4a (4f6356ed89d4f4988faf7d95a399ff6669718e4a)

@rust-timer
Copy link
Collaborator

Queued 4f6356ed89d4f4988faf7d95a399ff6669718e4a with parent 0b42dea, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (4f6356ed89d4f4988faf7d95a399ff6669718e4a): comparison url.

Summary: This benchmark run did not return any relevant changes.

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 led to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 10, 2021
Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright, the impl looks good to me.

Please add some comments to explain what's going on here though.

I think that in the lines

let mut unique = Rc::from_raw(Rc::into_raw(self).cast());

it makes sense to explicitly mention the type of unique somewhere, either in Rc::<...>::from_raw, in cast::<...> or as the type of unique itself. Same for Arc.

r=me with some helpful comments

@eggyal
Copy link
Contributor Author

eggyal commented Dec 13, 2021

@bors r=lcnr

@bors
Copy link
Contributor

bors commented Dec 13, 2021

📌 Commit 5920a1d has been approved by lcnr

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 13, 2021
@lcnr
Copy link
Contributor

lcnr commented Dec 13, 2021

good comments ❤️

@bors
Copy link
Contributor

bors commented Dec 13, 2021

⌛ Testing commit 5920a1d with merge 1796de7...

@bors
Copy link
Contributor

bors commented Dec 13, 2021

☀️ Test successful - checks-actions
Approved by: lcnr
Pushing 1796de7 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 13, 2021
@bors bors merged commit 1796de7 into rust-lang:master Dec 13, 2021
@rustbot rustbot added this to the 1.59.0 milestone Dec 13, 2021
@eggyal eggyal deleted the reuse-rcs-during-folding branch December 13, 2021 20:33
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1796de7): comparison url.

Summary: This benchmark run did not return any relevant changes.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants