Skip to content

Cow'ify some pprust methods #88262

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

Merged
merged 1 commit into from
Aug 29, 2021
Merged

Cow'ify some pprust methods #88262

merged 1 commit into from
Aug 29, 2021

Conversation

klensy
Copy link
Contributor

@klensy klensy commented Aug 23, 2021

Reduce number of potential needless de/allocations by using Cow<'static, str> instead of explicit String type.

@rust-highfive
Copy link
Contributor

r? @nagisa

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 23, 2021
@nagisa
Copy link
Member

nagisa commented Aug 23, 2021

Could you please adjust the PR description to include some motivation for this change (i.e. the why?)

@ghost
Copy link

ghost commented Aug 24, 2021

Could you please adjust the PR description to include some motivation for this change (i.e. the why?)

I'm confident that the goal of this PR is performance. It might be worth running a benchmark on this.

@klensy
Copy link
Contributor Author

klensy commented Aug 24, 2021

@r00ster91 I've edited PR description, previously it was empty.

@nagisa
Copy link
Member

nagisa commented Aug 24, 2021

Right, the goal of my request was to make sure there's less guessing involved as to what the motivation really is.


I don't think pretty printer is at all performance critical and therefore value of a benchmark here seems fairly low (and also pretty high-effort). The changes also don't seem all that intrusive either, so I'm happy to approve this based on the intuition that things are better this way.

Can you please also squash the commits together? r=me afterwards.

@Mark-Simulacrum
Copy link
Member

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 24, 2021
@bors
Copy link
Collaborator

bors commented Aug 24, 2021

⌛ Trying commit 5ca71fed1af4c962d0fb4dfccdb084146894066e with merge f91948fcb5e5a8daf32eabb6124dff78604d248e...

@bors
Copy link
Collaborator

bors commented Aug 24, 2021

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

@rust-timer
Copy link
Collaborator

Queued f91948fcb5e5a8daf32eabb6124dff78604d248e with parent 47ab5f7, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (f91948fcb5e5a8daf32eabb6124dff78604d248e): comparison url.

Summary: This change led to moderate relevant improvements 🎉 in compiler performance.

  • Moderate improvement in instruction counts (up to -0.9% on incr-full builds of coercions)

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
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 24, 2021
@inquisitivecrystal inquisitivecrystal added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Aug 24, 2021
@klensy
Copy link
Contributor Author

klensy commented Aug 29, 2021

Squashed.

@nagisa
Copy link
Member

nagisa commented Aug 29, 2021

@bors r+

@bors
Copy link
Collaborator

bors commented Aug 29, 2021

📌 Commit c565339 has been approved by nagisa

@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 Aug 29, 2021
@bors
Copy link
Collaborator

bors commented Aug 29, 2021

⌛ Testing commit c565339 with merge ae0b03b...

@bors
Copy link
Collaborator

bors commented Aug 29, 2021

☀️ Test successful - checks-actions
Approved by: nagisa
Pushing ae0b03b to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 29, 2021
@bors bors merged commit ae0b03b into rust-lang:master Aug 29, 2021
@rustbot rustbot added this to the 1.56.0 milestone Aug 29, 2021
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. 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