Skip to content

rustdoc: Use ThinVec in a few places#83828

Merged
bors merged 1 commit into
rust-lang:masterfrom
camelid:rustdoc-vec-perf
Apr 7, 2021
Merged

rustdoc: Use ThinVec in a few places#83828
bors merged 1 commit into
rust-lang:masterfrom
camelid:rustdoc-vec-perf

Conversation

@camelid

@camelid camelid commented Apr 3, 2021

Copy link
Copy Markdown
Member

Almost every crate has no primitives and no keywords defined in it, so
using ThinVec should make some types smaller.

@camelid camelid added I-compilemem Issue: Problems and improvements with respect to memory usage during compilation. I-compiletime Issue: Problems and improvements with respect to compile times. S-blocked Status: Blocked on something else such as an RFC or other implementation work. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Apr 3, 2021
@rust-highfive

Copy link
Copy Markdown
Contributor

r? @lcnr

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 3, 2021
@camelid

camelid commented Apr 3, 2021

Copy link
Copy Markdown
Member Author

r? @ghost (also, this is a T-rustdoc PR, but it includes commits from a PR that modifies the compiler)

@camelid camelid unassigned lcnr Apr 3, 2021
@camelid camelid added S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. labels Apr 3, 2021
@camelid

camelid commented Apr 3, 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 Apr 3, 2021
@bors

bors commented Apr 3, 2021

Copy link
Copy Markdown
Collaborator

⌛ Trying commit b98549512944f6ac37635db69053a1f609b24e86 with merge b9fd9ecb9bab4884a084e182d2af487064b59de3...

@camelid camelid added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 3, 2021
@bors

bors commented Apr 3, 2021

Copy link
Copy Markdown
Collaborator

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

@rust-timer

Copy link
Copy Markdown
Collaborator

Queued b9fd9ecb9bab4884a084e182d2af487064b59de3 with parent 97717a5, future comparison URL.

Comment thread compiler/rustc_data_structures/src/thin_vec.rs Outdated
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking try commit (b9fd9ecb9bab4884a084e182d2af487064b59de3): comparison url.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying rollup- to bors.

Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up.

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Apr 4, 2021
@jyn514

jyn514 commented Apr 4, 2021

Copy link
Copy Markdown
Member

This is a good idea. I'll try doing this in #83833.

@camelid

camelid commented Apr 4, 2021

Copy link
Copy Markdown
Member Author

Wow, that was actually a bigger improvement than I expected!

@camelid camelid removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 4, 2021
@camelid camelid added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Apr 4, 2021
@jyn514 jyn514 self-assigned this Apr 4, 2021
Comment thread src/librustdoc/clean/types.rs Outdated
Comment on lines 78 to 79

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not make it thinner by combining this two into one pointer?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What do you mean? These are stored in the ThinVec, on the heap, not on the stack.

@pickfire pickfire Apr 6, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, but since both of them are as rare, so we can just combine both into one pointer rather than two right? But yeah, if one is needed then we need the pointer already.

Only useful if both are always together at the same time.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's possible that combining them into one boxed field would make it smaller, but

  1. that would require code changes, and the slight perf improvement is likely not worth it;
  2. there probably won't be much of a perf improvement because padding may take up the space anyway.

@pickfire

pickfire commented Apr 5, 2021

Copy link
Copy Markdown
Contributor

Wow, that was actually a bigger improvement than I expected!

I can't see much improvements, the benchmark seemed neutral. How do you all see that?

Wait, do you mean all those -0.2%?

@camelid camelid removed the S-blocked Status: Blocked on something else such as an RFC or other implementation work. label Apr 6, 2021
@camelid camelid force-pushed the rustdoc-vec-perf branch from b985495 to a5f6dd1 Compare April 6, 2021 17:00
@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. labels Apr 6, 2021
Almost every crate has no primitives and no keywords defined in it, so
using `ThinVec` should make some types smaller.
@camelid camelid force-pushed the rustdoc-vec-perf branch from a5f6dd1 to 3ea8ebc Compare April 6, 2021 17:23
@jyn514

jyn514 commented Apr 6, 2021

Copy link
Copy Markdown
Member

@bors r+ rollup=never

@bors

bors commented Apr 6, 2021

Copy link
Copy Markdown
Collaborator

📌 Commit 3ea8ebc has been approved by jyn514

@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 Apr 6, 2021
@bors

bors commented Apr 6, 2021

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 3ea8ebc with merge 8b53ec6...

@bors

bors commented Apr 7, 2021

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-actions
Approved by: jyn514
Pushing 8b53ec6 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 7, 2021
@bors bors merged commit 8b53ec6 into rust-lang:master Apr 7, 2021
@rustbot rustbot added this to the 1.53.0 milestone Apr 7, 2021
@camelid camelid deleted the rustdoc-vec-perf branch April 7, 2021 03:07
@camelid

camelid commented Apr 8, 2021

Copy link
Copy Markdown
Member Author

Interestingly, the perf run after merge didn't show the instruction count improvements that the earlier perf run showed. Perhaps that could be due to the changes that were made in #83821 after the earlier perf run?

However, there did seem to be some max-rss improvements in regex-doc and clap-rs-doc. Though I don't feel confident enough in my knowledge of rustc-perf to know if they're spurious improvements or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

I-compilemem Issue: Problems and improvements with respect to memory usage during compilation. I-compiletime Issue: Problems and improvements with respect to compile times. 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.

9 participants