-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Merge DocContext.{ty,lt,ct}_substs
into one map
#90443
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
It's probably best to review this commit-by-commit, and potentially with whitespace hidden. |
@@ -222,7 +222,7 @@ impl Clean<Lifetime> for hir::Lifetime { | |||
| rl::Region::Free(_, node_id), | |||
) = def | |||
{ | |||
if let Some(lt) = cx.lt_substs.get(&node_id).cloned() { | |||
if let Some(lt) = cx.substs.get(&node_id).and_then(|p| p.as_lt()).cloned() { |
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.
I could've made this unwrap
the Option returned by as_lt
since it's a rustdoc bug for it to be None here, but it seemed simpler to just use and_then
. Let me know if you want me to use unwrap
as a sort of assertion. (Likewise with as_ty
below.)
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.
I guess it's fine... Maybe add a FIXME on it so we can come back to it later on?
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.
Let's either leave it as-is or switch it to unwrap
. I don't think it's worth a FIXME either way, and it's not actionable.
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 85d93c66d09ac8f793166ad190c1e3ba29cff528 with merge 57ef206d81386eab59b1c32b9e291ae1010c7f8e... |
This comment has been minimized.
This comment has been minimized.
Hmm, somehow I left trailing whitespace... |
It should be impossible to have more than one entry with a particular key across the three maps, so they should be one map. In addition to making it impossible for multiple entries to exist, this should improve memory usage since now only one map is allocated on the stack and heap.
☀️ Try build successful - checks-actions |
Queued 57ef206d81386eab59b1c32b9e291ae1010c7f8e with parent 68b554e, future comparison URL. |
Finished benchmarking commit (57ef206d81386eab59b1c32b9e291ae1010c7f8e): comparison url. Summary: This benchmark run did not return any relevant changes. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking 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 led to changes in compiler perf. @bors rollup=never |
There doesn't seem to have any memory usage to be displayed in the performance comparison... Kinda hard to judge if your PR has an impact on it haha. |
Otherwise the code looks good to me, but I'd be really interested about the RSS usage change. |
@GuillaumeGomez There's a max-rss comparison on the page rust-timer links to: https://perf.rust-lang.org/compare.html?start=68b554e6af18726fe6fa8de2134c59c441e0b019&end=57ef206d81386eab59b1c32b9e291ae1010c7f8e&stat=max-rss. There are some regressions for whatever reason, but it says they are all insignificant. |
Oh right, I forgot it was "hidden". So that still seems surprising that the memory usage grows in here... |
I wonder if it's because an enum is being stored, so there's an extra tag? We should probably find a way to get rid of these tables at some point too. |
85d93c6
to
5a77f30
Compare
Looks good to me, thanks! We can look for a way to remove the tables in another PR. @bors: r+ |
📌 Commit 5a77f30 has been approved by |
@bors rollup=never (just in case the max-rss changes are real) |
☀️ Test successful - checks-actions |
Finished benchmarking commit (5154727): comparison url. Summary: This change led to moderate relevant regressions 😿 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression |
The instruction count regressions that were reported are spurious—this change doesn't touch the compiler. Good news: no significant max-rss changes, so the regression reported previously was probably spurious. |
I'm adding back the perf-regression as its currently our only way of tracking interesting perf related cases. Don't worry about actually looking into this. The perf team will want to investigate why this change to rustdoc led to fairly significant changes in non-noisy test cases. We should not be spurious changes that are this large. @rustbot label: +perf-regression |
It should be impossible to have more than one entry with a particular
key across the three maps, so they should be one map. In addition to
making it impossible for multiple entries to exist, this should improve
memory usage since now only one map is allocated on the stack and heap.
r? @GuillaumeGomez