-
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
reduce the calls to tcx.is_coroutine
#118356
Conversation
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
…e, r=<try> reduce the calls to `tcx.is_coroutine` This commit includes two changes: 1. It merges two arms to address the comment raised in rust-lang#118311 (comment) 2. It attempts to solve the performance regression discussed in rust-lang#118319 (comment) by reducing the number of calls to `tcx.is_coroutine`. r? `@cjgillot`
☀️ Try build successful - checks-actions |
1 similar comment
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
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.
r=me with a nit
ty::ClosureKind::FnMut => Ty::new_mut_ref(tcx, tcx.lifetimes.re_erased, ty), | ||
ty::ClosureKind::FnOnce => ty, | ||
}; | ||
([self_ty].into_iter().chain(sig.inputs().to_vec()).collect(), sig.output(), None) |
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.
Do we need the to_vec()
?
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.
The goal to clone this slice and facilitate the return of a Vec<Ty>
. I think it's efficient enough as is, and there's no need to worry about further optimization.
Finished benchmarking commit (f4d884e): 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 a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis 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: 676.103s -> 675.273s (-0.12%) |
There doesn't appear to be a noticeable optimization compared to before. The regression might not be due to |
@bvanjoi any updates on this? Thanks |
This commit includes two changes:
DefKind::Coroutine
intoDefkind::Closure
#118311 (comment)tcx.is_coroutine
.r? @cjgillot