view-types: store borrows of view types in the AST#156016
view-types: store borrows of view types in the AST#156016scrabsha wants to merge 2 commits intorust-lang:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
52c4eee to
2bafb0c
Compare
This comment has been minimized.
This comment has been minimized.
2bafb0c to
7f6749b
Compare
7f6749b to
77bdbc2
Compare
This comment has been minimized.
This comment has been minimized.
d9ef8d8 to
ec789ac
Compare
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
view-types: store borrows of view types in the AST
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (9d3dea7): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 0.1%, secondary -2.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 3.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 503.61s -> 496.571s (-1.40%) |
This comment has been minimized.
This comment has been minimized.
ec789ac to
93208f2
Compare
|
^
r? nikomatsakis |
|
The Rustfmt subtree was changed cc @rust-lang/rustfmt The parser was modified, potentially altering the grammar of (stable) Rust cc @fmease Changes to the size of AST and/or HIR nodes. cc @nnethercote The Clippy subtree was changed cc @rust-lang/clippy Some changes occurred in compiler/rustc_builtin_macros/src/autodiff.rs cc @ZuseZ4 |
| static_assert_size!(Ty, 64); | ||
| static_assert_size!(TyKind, 40); | ||
| static_assert_size!(Ty, 80); | ||
| static_assert_size!(TyKind, 56); |
There was a problem hiding this comment.
This is very unfortunate, because Ty/TyKind are very common. It looks like the ViewKind::Partial variant is responsible. Boxing its fields would help, though might not be enough to get back to 64/40 bytes. A more awkward possibility would be to introduce RefPartial and PinnedRefPartial and box all the fields within. Presumably partial views will be much rarer than full views.
There was a problem hiding this comment.
That was my intuition too, but all the perf run seems to show is ~noise (on the green side).
I would like to avoid RefPartial and RefPinnedPartial because it would require duplicating a lot of patterns.
Unless you have a better idea, I will keep the data structures as is because "perf says it's ok", and add a comment saying we could box the content of ViewKind if it becomes perf-sensitive.
There was a problem hiding this comment.
Something I thought about last night is: do we really need to keep the span field in ViewKind::Partial. I'll try removing it first.
There was a problem hiding this comment.
I'm generally loathe to let the common struct kinds get bigger. Perhaps it's just superstition, but it feels like a recipe for slow perf degradation over time, with unpredictable memory/cache effects that CI runs might not catch, given that they're on a single machine.
There was a problem hiding this comment.
I ended up removing the span field (it was never used anywhere else), which brings the size to 72/48.
As I wrote earlier today, I am a bit worried about creating RefPartial and RefPinnedPartial variants. Feel free to reopen this thread if you want me to go on that route.
There was a problem hiding this comment.
I think it would be worth trying to see how painful it is, or if it inspires another approach to avoid the size growth.
There was a problem hiding this comment.
This makes me think that the variant should be View, so we can parse T.{} as well. Might be worth it actually!
93208f2 to
661a680
Compare
661a680 to
6035af1
Compare
View all comments
Tracking issue: #155938.
Instead of discarding view types, we store them in the AST now!