Skip to content
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

Closed

Conversation

bvanjoi
Copy link
Contributor

@bvanjoi bvanjoi commented Nov 27, 2023

This commit includes two changes:

  1. It merges two arms to address the comment raised in merge DefKind::Coroutine into Defkind::Closure #118311 (comment)
  2. It attempts to solve the performance regression discussed in Rollup of 4 pull requests #118319 (comment) by reducing the number of calls to tcx.is_coroutine.

r? @cjgillot

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 27, 2023
@rustbot
Copy link
Collaborator

rustbot commented Nov 27, 2023

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@lqd
Copy link
Member

lqd commented Nov 27, 2023

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 27, 2023
@bors
Copy link
Contributor

bors commented Nov 27, 2023

⌛ Trying commit 74ac565 with merge f4d884e...

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 27, 2023
…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`
@bors
Copy link
Contributor

bors commented Nov 27, 2023

☀️ Try build successful - checks-actions
Build commit: f4d884e (f4d884e6ce5fc686ac2a9ae529b819ce04ac21e7)

1 similar comment
@bors
Copy link
Contributor

bors commented Nov 27, 2023

☀️ Try build successful - checks-actions
Build commit: f4d884e (f4d884e6ce5fc686ac2a9ae529b819ce04ac21e7)

@rust-timer

This comment has been minimized.

Copy link
Contributor

@cjgillot cjgillot left a 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)
Copy link
Contributor

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()?

Copy link
Contributor Author

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.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f4d884e): comparison URL.

Overall result: ✅ improvements - no action needed

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 may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.3% [-0.3%, -0.3%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.3% [-0.3%, -0.3%] 1

Max RSS (memory usage)

Results

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.

mean range count
Regressions ❌
(primary)
1.2% [1.2%, 1.2%] 1
Regressions ❌
(secondary)
0.4% [0.4%, 0.5%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.2% [1.2%, 1.2%] 1

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 676.103s -> 675.273s (-0.12%)
Artifact size: 313.34 MiB -> 313.34 MiB (-0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 28, 2023
@bvanjoi
Copy link
Contributor Author

bvanjoi commented Nov 28, 2023

There doesn't appear to be a noticeable optimization compared to before. The regression might not be due to tcx.is_coroutine, but could possibly be caused by some process changes triggered by the modification of the condition

@cjgillot cjgillot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 2, 2023
@JohnCSimon JohnCSimon added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 11, 2024
@Dylan-DPC
Copy link
Member

@bvanjoi any updates on this? Thanks

@bvanjoi bvanjoi closed this Feb 18, 2024
@Dylan-DPC Dylan-DPC added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants