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

rustdoc: Box GenericArg::Const to reduce enum size #88574

Merged
merged 1 commit into from
Sep 4, 2021

Conversation

camelid
Copy link
Member

@camelid camelid commented Sep 1, 2021

This should reduce the amount of memory allocated in the common cases
where the GenericArg is a lifetime or type.

@camelid camelid added I-compilemem Issue: Problems and improvements with respect to memory usage during compilation. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 1, 2021
@camelid
Copy link
Member Author

camelid commented Sep 1, 2021

(It's blocked because they change similar code and I think that could cause the results to be spurious.)

@hellow554
Copy link
Contributor

#88522 has been merged successfully and no rebase seems to be needed. So let's go?

@camelid
Copy link
Member Author

camelid commented Sep 2, 2021

#88522 has been merged successfully and no rebase seems to be needed. So let's go?

Yeah, I forgot that CI rebases before testing, but I'll still rebase just in case :)

@camelid
Copy link
Member Author

camelid commented Sep 2, 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 Sep 2, 2021
@bors
Copy link
Contributor

bors commented Sep 2, 2021

⌛ Trying commit 3b61d37a27214aacc220e8eb6c37c176e8617832 with merge 459a20808114e18608987a33b457c76d3ffa7a17...

@camelid camelid added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. labels Sep 2, 2021
@camelid
Copy link
Member Author

camelid commented Sep 2, 2021

r? @GuillaumeGomez

@bors
Copy link
Contributor

bors commented Sep 2, 2021

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

@rust-timer
Copy link
Collaborator

Queued 459a20808114e18608987a33b457c76d3ffa7a17 with parent fcce644, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (459a20808114e18608987a33b457c76d3ffa7a17): comparison url.

Summary: This change led to small relevant mixed results 🤷 in compiler performance.

  • Small improvement in instruction counts (up to -0.4% on incr-full builds of deep-vector)
  • Small regression in instruction counts (up to 0.5% on full builds of deep-vector)

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.

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

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

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Sep 2, 2021
@camelid
Copy link
Member Author

camelid commented Sep 2, 2021

I'm pretty sure those regressions that rust-timer is reporting are spurious, because they are for non-doc builds, which shouldn't be affected at all by this change.

No significant changes in *-doc instruction count, but max-rss looks to be improved on virtually all *-doc benchmarks; the biggest improvements are for deeply-nested-doc at 1.2%, clap-rs-doc at about 1%, and serde-doc at about 1%. The only significant (according to the webpage) regression is 0.21% for tokio-webpush-simple-doc, which could be spurious.

@camelid camelid marked this pull request as ready for review September 2, 2021 21:34
@Mark-Simulacrum
Copy link
Member

@bors try @rust-timer queue

Let's see if they reproduce, perhaps? But seem likely to not be related to this PR.

@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 Sep 2, 2021
@bors
Copy link
Contributor

bors commented Sep 2, 2021

⌛ Trying commit 3b61d37a27214aacc220e8eb6c37c176e8617832 with merge d19374152c9e11c22593659de62dfacd47145920...

@bors
Copy link
Contributor

bors commented Sep 2, 2021

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

@rust-timer
Copy link
Collaborator

Queued d19374152c9e11c22593659de62dfacd47145920 with parent b834c4c, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (d19374152c9e11c22593659de62dfacd47145920): comparison url.

Summary: This change led to small relevant mixed results 🤷 in compiler performance.

  • Small improvement in instruction counts (up to -0.6% on full builds of deep-vector)
  • Small regression in instruction counts (up to 0.5% on incr-full builds of coercions)

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.

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@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 Sep 3, 2021
@GuillaumeGomez
Copy link
Member

Should we add a static_assert_size! for GenericArg then?

@camelid
Copy link
Member Author

camelid commented Sep 3, 2021

Seems pretty likely that these rustc regressions and rustc improvements are spurious, because they shouldn't be affected by this change and because in the first run, it reported

Small regression in instruction counts (up to 0.5% on full builds of deep-vector)

but on this run, it reported:

Small improvement in instruction counts (up to -0.6% on full builds of deep-vector)

Removing the perf-regression label then.

@camelid camelid removed the perf-regression Performance regression. label Sep 3, 2021
@camelid
Copy link
Member Author

camelid commented Sep 3, 2021

tuple-stress-doc showed a 10% max-rss regression in the second perf run, but I'm pretty sure it's spurious because there were no significant changes for it in the first run. Also, it doesn't use anything that I would expect to be affected by this change.

@camelid
Copy link
Member Author

camelid commented Sep 3, 2021

Aside from that, significant improvements ranged from 0.3% to 1%. serde-doc improved by the exact same amount both runs too (1.03%).

@camelid
Copy link
Member Author

camelid commented Sep 3, 2021

Should we add a static_assert_size! for GenericArg then?

Yeah, that's probably a good idea.

@camelid
Copy link
Member Author

camelid commented Sep 3, 2021

Should we add a static_assert_size! for GenericArg then?

Ok, done!

@GuillaumeGomez
Copy link
Member

Thanks!

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Sep 4, 2021

📌 Commit 5c0e6c1 has been approved by GuillaumeGomez

@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 Sep 4, 2021
@camelid
Copy link
Member Author

camelid commented Sep 4, 2021

@bors rollup-

This affects performance.

@camelid
Copy link
Member Author

camelid commented Sep 4, 2021

@bors rollup=never

@bors
Copy link
Contributor

bors commented Sep 4, 2021

⌛ Testing commit 5c0e6c1 with merge b89e01c...

@bors
Copy link
Contributor

bors commented Sep 4, 2021

☀️ Test successful - checks-actions
Approved by: GuillaumeGomez
Pushing b89e01c to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 4, 2021
@bors bors merged commit b89e01c into rust-lang:master Sep 4, 2021
@rustbot rustbot added this to the 1.57.0 milestone Sep 4, 2021
@camelid camelid deleted the box-genericarg-const branch September 4, 2021 22:37
@lcnr lcnr added the A-const-generics Area: const generics (parameters and arguments) label Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-generics Area: const generics (parameters and arguments) I-compilemem Issue: Problems and improvements with respect to memory usage during compilation. 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-rustdoc Relevant to the rustdoc 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