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

Calculate span info on-demand #80339

Merged
merged 4 commits into from
Apr 25, 2021
Merged

Calculate span info on-demand #80339

merged 4 commits into from
Apr 25, 2021

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Dec 23, 2020

  • Add helper attr_span for common reused function
  • Stop storing Spans on Item directly; calculate them on demand instead
  • Special case modules, which have different spans depending on whether
    you use inner or outer attributes
  • Special case impls with fake IDs, which can have either dummy spans (for auto traits) or the DefId of the impl block (for blanket impls)
  • Use a fake ID for primitives instead of the ID of the crate; this lets
    source() know that it should use a dummy span instead of the span of
    the crate.

This shrinks Item from 48 to 40 bytes.

Helps with #76382.

@jyn514 jyn514 added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Dec 23, 2020
@rust-highfive

This comment has been minimized.

@rust-highfive
Copy link
Collaborator

r? @GuillaumeGomez

(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 Dec 23, 2020
@rust-log-analyzer

This comment has been minimized.

@jyn514
Copy link
Member Author

jyn514 commented Dec 23, 2020

The failure is strange - it looks like the file src/core/slice/ascii.rs.html is no longer being generated? Not sure what that has to do with my changes ... let me try reverting the change to primitive IDs.

@jyn514
Copy link
Member Author

jyn514 commented Dec 23, 2020

let me try reverting the change to primitive IDs.

that did not help :(

@jyn514 jyn514 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-review Status: Awaiting review from the assignee but also interested parties. labels Dec 23, 2020
@bors

This comment has been minimized.

@jyn514 jyn514 force-pushed the no-span branch 2 times, most recently from 5d3d456 to 30d2b24 Compare January 8, 2021 01:15
@jyn514 jyn514 mentioned this pull request Jan 8, 2021
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bors

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 14, 2021
Box Item::Attributes

This reduces the size of Item from 128 to 40 bytes. I think this is as small as it needs to get 🎉

Builds on rust-lang#80339 and should not be merged before.

r? `@GuillaumeGomez`
@bors

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@jyn514 jyn514 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. labels Feb 19, 2021
@bors

This comment has been minimized.

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 24, 2021
@jyn514
Copy link
Member Author

jyn514 commented Apr 24, 2021

Up to -1.2% in instruction counts on many of the -doc benchmarks. Max-rss looks like noise.

@bors r=GuillaumeGomez

@bors
Copy link
Contributor

bors commented Apr 24, 2021

📌 Commit 63a08e6d29463892a0dbdb828aa193454e7c79d8 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 Apr 24, 2021
@GuillaumeGomez
Copy link
Member

Less than what I was hoping for but still great!

@bors

This comment has been minimized.

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 24, 2021
The only bit failing was the module, so change that before removing the
`span` field.
- Remove `span` field, adding `Item::span()` instead
- Special-case `Impl` and `Module` items
- Use dummy spans for primitive items
@jyn514
Copy link
Member Author

jyn514 commented Apr 24, 2021

@bors r=GuillaumeGomez

@bors
Copy link
Contributor

bors commented Apr 24, 2021

📌 Commit ba36142 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 24, 2021
@bors
Copy link
Contributor

bors commented Apr 25, 2021

⌛ Testing commit ba36142 with merge f7c468f...

@bors
Copy link
Contributor

bors commented Apr 25, 2021

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

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