-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustdoc: Rearrange Item
/ItemInner
.
#138927
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
Conversation
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
…, r=<try> 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>`. (`Vec<Box<Item>>` would also work.) `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. This commit does the second option, giving a tiny `Item`. r? `@ghost`
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (ffdc630): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary -1.4%, secondary -0.6%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (secondary 1.2%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 777.441s -> 777.041s (-0.05%) |
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. rust-lang#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.
4312081
to
ffee55c
Compare
Good doc perf results: icounts don't change much, but cycles, wall-time and max-rss all show improvements. (This is a case where enabling "Show non-relevant results" is worthwhile.) I also tried merging |
Great catch! Funny that no one noticed it. All good for me, thanks! @bors r+ rollup=iffy |
☀️ Test successful - checks-actions |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing ecb170a (parent) -> 217693a (this PR) Test differencesShow 32935 test diffsStage 1
Stage 2
(and 16364 additional test diffs) Additionally, 16471 doctest diffs were found. These are ignored, as they are noisy. Job group index
|
Finished benchmarking commit (217693a): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary -0.7%, secondary 1.9%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 779.46s -> 778.49s (-0.12%) |
The post-merge perf CI results (slight perf wins overall) were less good than the pre-merge results (clear perf wins overall), for no obvious reason. (Only the |
The
Item
struct is 48 bytes and contains aBox<ItemInner>
;ItemInner
is 104 bytes. This is an odd arrangement. Normally you'dhave one of the following.
A single large struct, which avoids the allocation for the
Box
, butcan 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 theBox
allocation but gives a very small Item size, which is good forcontainers like
Vec<Item>
.Item
/ItemInner
currently gets the worst of both worlds: it alwaysrequires a
Box
, butItem
is also pretty big and so wastes space incontainers. 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