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: Use ThinVec in a few places #83828

Merged
merged 1 commit into from
Apr 7, 2021
Merged

Conversation

camelid
Copy link
Member

@camelid camelid commented Apr 3, 2021

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: Marked as 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
Collaborator

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

camelid commented Apr 3, 2021

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

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

bors commented Apr 3, 2021

⌛ 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
Copy link
Contributor

bors commented Apr 3, 2021

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

@rust-timer
Copy link
Collaborator

Queued b9fd9ecb9bab4884a084e182d2af487064b59de3 with parent 97717a5, future comparison URL.

@rust-timer
Copy link
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
Copy link
Member

jyn514 commented Apr 4, 2021

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

@camelid
Copy link
Member Author

camelid commented Apr 4, 2021

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 on lines +78 to +79
crate primitives: ThinVec<(DefId, PrimitiveType)>,
crate keywords: ThinVec<(DefId, Symbol)>,
Copy link
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
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.

Copy link
Contributor

@pickfire pickfire Apr 6, 2021

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

pickfire commented Apr 5, 2021

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: Marked as blocked ❌ on something else such as an RFC or other implementation work. label Apr 6, 2021
@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.
@jyn514
Copy link
Member

jyn514 commented Apr 6, 2021

@bors r+ rollup=never

@bors
Copy link
Contributor

bors commented Apr 6, 2021

📌 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
Copy link
Contributor

bors commented Apr 6, 2021

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

@bors
Copy link
Contributor

bors commented Apr 7, 2021

☀️ 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
Copy link
Member Author

camelid commented Apr 8, 2021

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