Skip to content

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

Merged
bors merged 1 commit into
rust-lang:masterfrom
camelid:box-genericarg-const
Sep 4, 2021
Merged

rustdoc: Box GenericArg::Const to reduce enum size#88574
bors merged 1 commit into
rust-lang:masterfrom
camelid:box-genericarg-const

Conversation

@camelid

@camelid camelid commented Sep 1, 2021

Copy link
Copy Markdown
Member

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: 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

camelid commented Sep 1, 2021

Copy link
Copy Markdown
Member Author

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

@hellow554

Copy link
Copy Markdown
Contributor

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

@camelid

camelid commented Sep 2, 2021

Copy link
Copy Markdown
Member Author

#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 camelid force-pushed the box-genericarg-const branch from e12171d to 3b61d37 Compare September 2, 2021 16:12
@camelid

camelid commented Sep 2, 2021

Copy link
Copy Markdown
Member Author

@bors try @rust-timer queue

@rust-timer

Copy link
Copy Markdown
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

bors commented Sep 2, 2021

Copy link
Copy Markdown
Collaborator

⌛ 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: Blocked on something else such as an RFC or other implementation work. labels Sep 2, 2021
@camelid

camelid commented Sep 2, 2021

Copy link
Copy Markdown
Member Author

r? @GuillaumeGomez

@bors

bors commented Sep 2, 2021

Copy link
Copy Markdown
Collaborator

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

@rust-timer

Copy link
Copy Markdown
Collaborator

Queued 459a20808114e18608987a33b457c76d3ffa7a17 with parent fcce644, future comparison URL.

@rust-timer

Copy link
Copy Markdown
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

camelid commented Sep 2, 2021

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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
Copy Markdown
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

bors commented Sep 2, 2021

Copy link
Copy Markdown
Collaborator

⌛ Trying commit 3b61d37a27214aacc220e8eb6c37c176e8617832 with merge d19374152c9e11c22593659de62dfacd47145920...

@bors

bors commented Sep 2, 2021

Copy link
Copy Markdown
Collaborator

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

@rust-timer

Copy link
Copy Markdown
Collaborator

Queued d19374152c9e11c22593659de62dfacd47145920 with parent b834c4c, future comparison URL.

@rust-timer

Copy link
Copy Markdown
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
Copy Markdown
Member

Should we add a static_assert_size! for GenericArg then?

@camelid

camelid commented Sep 3, 2021

Copy link
Copy Markdown
Member Author

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

camelid commented Sep 3, 2021

Copy link
Copy Markdown
Member Author

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

camelid commented Sep 3, 2021

Copy link
Copy Markdown
Member Author

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

camelid commented Sep 3, 2021

Copy link
Copy Markdown
Member Author

Should we add a static_assert_size! for GenericArg then?

Yeah, that's probably a good idea.

@camelid camelid force-pushed the box-genericarg-const branch from 3b61d37 to 5c0e6c1 Compare September 3, 2021 23:35
@camelid

camelid commented Sep 3, 2021

Copy link
Copy Markdown
Member Author

Should we add a static_assert_size! for GenericArg then?

Ok, done!

@GuillaumeGomez

Copy link
Copy Markdown
Member

Thanks!

@bors: r+ rollup

@bors

bors commented Sep 4, 2021

Copy link
Copy Markdown
Collaborator

📌 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

camelid commented Sep 4, 2021

Copy link
Copy Markdown
Member Author

@bors rollup-

This affects performance.

@camelid

camelid commented Sep 4, 2021

Copy link
Copy Markdown
Member Author

@bors rollup=never

@bors

bors commented Sep 4, 2021

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 5c0e6c1 with merge b89e01c...

@bors

bors commented Sep 4, 2021

Copy link
Copy Markdown
Collaborator

☀️ 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