diff options
| author | bors <bors@rust-lang.org> | 2025-03-27 15:22:17 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-03-27 15:22:17 +0000 |
| commit | 217693a1f02ca6431a434926ff3417bdb6dbac2e (patch) | |
| tree | 8647d21dd1a79f83aae4382fa567fc006de1af8c /src/librustdoc/formats/cache.rs | |
| parent | ecb170afc878648c3ae355dbd596c8e4b6f7ebdc (diff) | |
| parent | ffee55c18c19c551d58a6d68e1b3feb7618d0455 (diff) | |
| download | rust-217693a1f02ca6431a434926ff3417bdb6dbac2e.tar.gz rust-217693a1f02ca6431a434926ff3417bdb6dbac2e.zip | |
Auto merge of #138927 - nnethercote:rearrange-Item-ItemInner, r=GuillaumeGomez
rustdoc: Rearrange `Item`/`ItemInner`. The `Item` struct is 48 bytes and contains a `Box<ItemInner>`; `ItemInner` is 104 bytes. This is an odd arrangement. Normally you'd have one of the following. - A single large struct, which avoids the allocation for the `Box`, but can result in lots of wasted space in unused parts of a container like `Vec<Item>`, `HashSet<Item>`, etc. - Or, something like `struct Item(Box<ItemInner>)`, which requires the `Box` allocation but gives a very small Item size, which is good for containers like `Vec<Item>`. `Item`/`ItemInner` currently gets the worst of both worlds: it always requires a `Box`, but `Item` is also pretty big and so wastes space in containers. It would make sense to push it in one direction or the other. #138916 showed that the first option is a regression for rustdoc, so this commit does the second option, which improves speed and reduces memory usage. r? `@GuillaumeGomez`
Diffstat (limited to 'src/librustdoc/formats/cache.rs')
| -rw-r--r-- | src/librustdoc/formats/cache.rs | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs index e74fd67fbda..19402004ed5 100644 --- a/src/librustdoc/formats/cache.rs +++ b/src/librustdoc/formats/cache.rs @@ -385,7 +385,6 @@ impl DocFolder for CacheBuilder<'_, '_> { // implementations elsewhere. let ret = if let clean::Item { inner: box clean::ItemInner { kind: clean::ImplItem(ref i), .. }, - .. } = item { // Figure out the id of this impl. This may map to a |
