-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Box ast::ItemKind
#81400
Box ast::ItemKind
#81400
Conversation
This reduces the size of ast::Item from 296 to 96 bytes.
r? @davidtwco (rust-highfive has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
Awaiting bors try build completion. |
⌛ Trying commit 6f5d4b8 with merge 76f647b0d68bb484dfaf12d4025354e07fdda7c6... |
The job Click to see the possible cause of the failure (guessed by this bot)
|
☀️ Try build successful - checks-actions |
Queued 76f647b0d68bb484dfaf12d4025354e07fdda7c6 with parent f4eb5d9, future comparison URL. @rustbot label: +S-waiting-on-perf |
The fact that this had to be done genuinely scares me. |
Finished benchmarking try commit (76f647b0d68bb484dfaf12d4025354e07fdda7c6): 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 |
@@ -2593,6 +2593,10 @@ pub struct Item<K = ItemKind> { | |||
pub tokens: Option<LazyTokenStream>, | |||
} | |||
|
|||
rustc_data_structures::static_assert_size!(Item<ItemKind>, 96); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this account for pointer size differences across platforms?
Well this has the exact opposite effect: increasing memory use. On the flip side, a small perf gain. |
The biggest
|
I'm not planning to follow up on this. |
Box the biggest ast::ItemKind variants This PR is a different approach on rust-lang#81400, aiming to save memory in humongous ASTs. The three affected item kind enums are: - `ast::ItemKind` (208 -> 112 bytes) - `ast::AssocItemKind` (176 -> 72 bytes) - `ast::ForeignItemKind` (176 -> 72 bytes)
Box the biggest ast::ItemKind variants This PR is a different approach on rust-lang/rust#81400, aiming to save memory in humongous ASTs. The three affected item kind enums are: - `ast::ItemKind` (208 -> 112 bytes) - `ast::AssocItemKind` (176 -> 72 bytes) - `ast::ForeignItemKind` (176 -> 72 bytes)
This reduces the size of ast::Item from 296 to 96 bytes.
See https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/223974946 for context; the hope is this will save memory compiling windows-rs.