Skip to content

Use less catch_unwind in lang_start_internal #109051

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

Closed
wants to merge 1 commit into from

Conversation

joboet
Copy link
Member

@joboet joboet commented Mar 12, 2023

Moving abort guards to destructors can yield better codegen than catch_unwind in user code, so perhaps it also works for lang_start?

Could someone trigger rust-timer for me, please? I don't have permissions.

Using an aborting drop guard to stop unwinding is a bit cleaner and avoids the footguns associated with catch_unwind.

The impact on binary size is unfortunately negligible (-4kB on my machine for "hello world").

@rustbot
Copy link
Collaborator

rustbot commented Mar 12, 2023

r? @Mark-Simulacrum

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Mar 12, 2023
@Noratrieb
Copy link
Member

I don't think rustc perf will have any useful results, the compiler is a very big program so this small one time startup change will probably not make it over the noise threshold. You're probably better off benchmarking a hello world or something like that locally.

@joboet
Copy link
Member Author

joboet commented Mar 12, 2023

I don't think rustc perf will have any useful results, the compiler is a very big program so this small one time startup change will probably not make it over the noise threshold. You're probably better off benchmarking a hello world or something like that locally.

lang_start did previously have a perf-impact (#88988), so I'm curious whether it does here as well. But sure, I'll test it locally first.

@Noratrieb
Copy link
Member

Well, I can start one anyways, we have enough
@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 Mar 12, 2023
@bors
Copy link
Collaborator

bors commented Mar 12, 2023

⌛ Trying commit 19910f1a550a300ef0153176fdb69baacff3d0cb with merge 71e1728448334ed5b308e433eb07ff411a98b7e6...

@bors
Copy link
Collaborator

bors commented Mar 12, 2023

☀️ Try build successful - checks-actions
Build commit: 71e1728448334ed5b308e433eb07ff411a98b7e6 (71e1728448334ed5b308e433eb07ff411a98b7e6)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (71e1728448334ed5b308e433eb07ff411a98b7e6): comparison URL.

Overall result: no relevant changes - 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 benchmark run did not return any relevant results for this metric.

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)
- - 0
Regressions ❌
(secondary)
3.5% [2.8%, 4.2%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.5% [-2.5%, -2.5%] 1
All ❌✅ (primary) - - 0

Cycles

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

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 13, 2023
@joboet joboet changed the title [experiment] Use less catch_unwind in lang_start_internal Use less catch_unwind in lang_start_internal Mar 13, 2023
@joboet joboet force-pushed the optimize_lang_start branch from 19910f1 to 6f35373 Compare March 13, 2023 11:19
@joboet joboet marked this pull request as ready for review March 13, 2023 11:20
@rustbot
Copy link
Collaborator

rustbot commented Mar 13, 2023

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@joboet
Copy link
Member Author

joboet commented Mar 13, 2023

@rustbot author
Until I figure out CI...

@rustbot rustbot 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 Mar 13, 2023
@JohnCSimon
Copy link
Member

@joboet

ping from triage - can you post your status on this PR? There hasn't been an update in a few months. Thanks!

FYI: when a PR is ready for review, send a message containing
@rustbot ready to switch to S-waiting-on-review so the PR is in the reviewer's backlog.

@joboet
Copy link
Member Author

joboet commented Jun 21, 2023

This doesn't really have an impact except maybe making the code a bit more readable, so I'm not really motivated to find the issue that caused CI to fail here. I'll just close this.

@joboet joboet closed this Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants