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

Check RUSTC_CTFE_BACKTRACE much less by generating fewer errors #69290

Merged
merged 1 commit into from
Feb 21, 2020

Conversation

wesleywiser
Copy link
Member

@wesleywiser wesleywiser commented Feb 19, 2020

Before this change, get_size_and_align() calls get_fn_alloc() a
lot
in CTFE heavy code. This previously returned an Error which would
check if RUSTC_CTFE_BACKTRACE was set on construction. Doing this
turned out to be a performance hotspot as @nnethercote discovered in
#68792.

This is an alternate take on that PR which resolves the performance
issue by generating many fewer errors. Previously, ctfe-stress-4
would generate over 5,000,000 errors each of which would check for the
presence of the environment variable. With these changes, that number is
reduced to 30.

r? @RalfJung

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 19, 2020
@wesleywiser
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Feb 19, 2020

⌛ Trying commit e9d7e4c5637d1584551727e34e6fc7ffb98bdad8 with merge 86fcc9b22b448b73a89589ccc348771cdd426a09...

@RalfJung
Copy link
Member

Looks good, r=me when perf agrees

@RalfJung
Copy link
Member

(But I think there's a typo in the PR description where it fails to link to where @nnethercote discovered the problem.)

@wesleywiser
Copy link
Member Author

Heh. Vim word-wrapped the line as I was typing the issue number and since git-commit ignores lines that start with #, it removed the line.

@RalfJung
Copy link
Member

Also, adding the flag to the session as you proposed would still probably be better than the current env var scheme. Even if this solves the main perf problem, there is no good reason to make error creation that expensive.

@bors
Copy link
Contributor

bors commented Feb 19, 2020

☀️ Try build successful - checks-azure
Build commit: 86fcc9b22b448b73a89589ccc348771cdd426a09 (86fcc9b22b448b73a89589ccc348771cdd426a09)

@rust-timer
Copy link
Collaborator

Queued 86fcc9b22b448b73a89589ccc348771cdd426a09 with parent ae54678, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit 86fcc9b22b448b73a89589ccc348771cdd426a09, comparison URL.

@RalfJung
Copy link
Member

8% speedup, nice :)

@bors r+ rollup=never
(@nnethercote I assume as this has perf impact it should not be rolled up?)

@bors
Copy link
Contributor

bors commented Feb 19, 2020

📌 Commit e9d7e4c5637d1584551727e34e6fc7ffb98bdad8 has been approved by RalfJung

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 19, 2020
@RalfJung RalfJung mentioned this pull request Feb 19, 2020
2 tasks
@wesleywiser
Copy link
Member Author

@RalfJung Yeah, that's correct. PRs that impact performance shouldn't be rolled up.

@nnethercote
Copy link
Contributor

Nice perf results! I didn't realize this would help benchmarks other than ctfe-stress-4, that's good to see.

@nnethercote
Copy link
Contributor

BTW, before this lands can you reword the commit message so that the # doesn't appear at the start of a line?

@RalfJung
Copy link
Member

@bors r-
for commit msg ediitng

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 19, 2020
Before this change, `get_size_and_align()`  calls `get_fn_alloc()` *a
lot* in CTFE heavy code. This previously returned an `Error` which would
check if `RUSTC_CTFE_BACKTRACE` was set on construction. Doing this
turned out to be a performance hotspot as @nnethercote discovered in
rust-lang#68792.

This is an alternate take on that PR which resolves the performance
issue by generating *many* fewer errors. Previously, `ctfe-stress-4`
would generate over 5,000,000 errors each of which would check for the
presence of the environment variable. With these changes, that number is
reduced to 30.
@wesleywiser
Copy link
Member Author

@bors r=RalfJung

@bors
Copy link
Contributor

bors commented Feb 19, 2020

📌 Commit 9f3bc82 has been approved by RalfJung

@bors bors removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Feb 19, 2020
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Feb 19, 2020
@bors
Copy link
Contributor

bors commented Feb 21, 2020

⌛ Testing commit 9f3bc82 with merge 01a8b5f...

@bors
Copy link
Contributor

bors commented Feb 21, 2020

☀️ Test successful - checks-azure
Approved by: RalfJung
Pushing 01a8b5f to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 21, 2020
@bors bors merged commit 01a8b5f into rust-lang:master Feb 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants