Uh oh!
There was an error while loading. Please reload this page.
[rustdoc] Box ItemKind to reduce the size of Item - #80014
Conversation
rust-highfive
commented
Dec 13, 2020
Some changes occurred in intra-doc-links. cc @jyn514 |
rust-highfive
commented
Dec 13, 2020
r? @ollie27 (rust-highfive has picked a reviewer for you, use r? to override) |
jyn514
commented
Dec 13, 2020
@bors try @rust-timer queue |
rust-timer
commented
Dec 13, 2020
Awaiting bors try build completion |
bors
commented
Dec 13, 2020
⌛ Trying commit 1b6bb0c79853f4d96b91679f5a01cd6c79291ba8 with merge 5060bdc312fd830ad807a5d08d2f884ef1303a1c... |
bors
commented
Dec 13, 2020
☀️ Try build successful - checks-actions |
rust-timer
commented
Dec 13, 2020
Queued 5060bdc312fd830ad807a5d08d2f884ef1303a1c with parent 057937b, future comparison URL. |
rust-timer
commented
Dec 13, 2020
Finished benchmarking try commit (5060bdc312fd830ad807a5d08d2f884ef1303a1c): 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 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 |
jyn514
commented
Dec 13, 2020
Up to -1.7% on instructions, up to -3.1% on max-rss. The RSS numbers for rustdoc seem to be less variable than for rustc for some reason. |
jyn514
commented
Dec 14, 2020
r? @nnethercote maybe? |
pnkfelix
commented
Dec 16, 2020
Is there a way you could measure how much it helps reduce the peak memory usage there? |
nnethercote
commented
Dec 16, 2020
Can you add a static assertion on the size to prevent future regressions? Something like this, which is a pattern used in various places in the compiler: r=me with that done. Also, 280 bytes is still large. Most of the AST types in the compiler itself are less than 100 bytes. Which fields are big? |
@nnethercote you should have seen when I started, it was 784 bytes 😆 #79957 (comment) This is all changing rather rapidly so I'm a little hesitant to put an assert since it will make rebasing harder. After rebasing over master the new change is from 616 to 216.
So most of the size is coming from Attributes, Visibility, and (Stability, Deprecation, ConstStability). The last three are from rustc directly. A way I thought of to reduce that size is to calculate them on demand with something like enumItemId{Real(DefId),Fake(usize),}implItem{fnstability() -> Option<Stability>{ ...}}and then always return I do not currently have ideas for reducing the size of Visibility or Attributes. |
Measuring this (imprecisely, with FYI, all of these measurements are done with |
This comment has been minimized.
This comment has been minimized.
Pass a `TyCtxt` through to `FormatRender` This is the next step after rust-lang#79957 for rust-lang#76382. Eventually I plan to use this to remove `stability`, `const_stability`, and `deprecation` from `Item`, but that needs more extensive changes (in particular, rust-lang#75355 or something like it). This has no actual changes to behavior, it's just moving types around. ccc rust-lang#80014 (comment)
This comment has been minimized.
This comment has been minimized.
…meGomez [rustdoc] Calculate stability, const_stability, and deprecation on-demand Previously, they would always be calculated ahead of time, which bloated the size of `clean::Item`. Builds on rust-lang#80090 and should not be merged before. Helps with rust-lang#79103 and rust-lang#76382. cc rust-lang#80014 (comment) This brings `Item` down to 568 bytes, down from 616.
…umeGomez Remove `DefPath` from `Visibility` and calculate it on demand Depends on rust-lang#80090 and should not be merged before. Helps with rust-lang#79103 and rust-lang#76382. cc rust-lang#80014 (comment) - `@nnethercote` I figured it out! It was simpler than I expected :) This brings the size of `clean::Visibility` down from 40 bytes to 8. Note that this does *not* remove `clean::Visibility`, even though it's now basically the same as `ty::Visibility`, because the `Invsible` variant means something different from `Inherited` and I thought it would be be confusing to merge the two. See the new comments on `impl Clean for ty::Visibility` for details.
This comment has been minimized.
This comment has been minimized.
This brings the size of `Item` from ``` [src/librustdoc/lib.rs:103] std::mem::size_of::<Item>() = 680 ``` to ``` [src/librustdoc/lib.rs:103] std::mem::size_of::<Item>() = 280 ```
This now brings the size from 536 to 136 bytes. |
This comment has been minimized.
This comment has been minimized.
jyn514
commented
Dec 29, 2020
I added the static assertion. @bors r=nnethercote |
bors
commented
Dec 29, 2020
📌 Commit 5fce0dd has been approved by |
jyn514
commented
Dec 29, 2020
@bors rollup=never |
bors
commented
Dec 29, 2020
bors
commented
Dec 29, 2020
☀️ Test successful - checks-actions |
This brings the size of
Itemfromto
This is an alternative to #79967; I don't think it makes sense to make both changes.
Helps with #79103.