Skip to content

Intern more strings #5293

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
Apr 4, 2018
Merged

Intern more strings #5293

merged 1 commit into from
Apr 4, 2018

Conversation

Eh2406
Copy link
Contributor

@Eh2406 Eh2406 commented Apr 4, 2018

As pointed out in #5270 (comment), that clean up adds the mildly expensive InternedString::new to the hot path in the resolver.

The process of this PR is:

  1. Find a InternedString::new in the hot path.
  2. replace the argument of type &str that is passed along to InternedString::new with the type InternedString
  3. add an InternedString::new to the callers until it type checked.
  4. Repeat from step 1.

This stop if:

  • It was traced back to something that was already an InternedString
  • It was traced back to a .to_string() call
  • It was in a persistent object creation

cc:

  • @djc this is building on your work, I don't want to get in your way.
  • @alexcrichton is this making things clearer and do you want to see a performance check?

@djc
Copy link
Contributor

djc commented Apr 4, 2018

@Eh2406 no problem! This looks sane to me.

@bors
Copy link
Contributor

bors commented Apr 4, 2018

☔ The latest upstream changes (presumably #5292) made this pull request unmergeable. Please resolve the merge conflicts.

@alexcrichton
Copy link
Member

Looks reasonable to me, thanks!

I'm ok landing this without requiring a benchmark

cargo +stable fmt
@Eh2406 Eh2406 force-pushed the InternMoreStrings branch from 9013354 to 5c9d34b Compare April 4, 2018 19:44
@Eh2406
Copy link
Contributor Author

Eh2406 commented Apr 4, 2018

Rebased.

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Apr 4, 2018

📌 Commit 5c9d34b has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Apr 4, 2018

⌛ Testing commit 5c9d34b with merge 29d9960...

bors added a commit that referenced this pull request Apr 4, 2018
Intern more strings

As pointed out in #5270 (comment), that clean up adds the mildly expensive `InternedString::new` to the hot path in the resolver.

The process of this PR is:
1. Find a `InternedString::new` in the hot path.
2. replace the argument of type `&str` that is passed along to `InternedString::new` with the type `InternedString`
3. add an `InternedString::new` to the callers until it type checked.
4. Repeat from step 1.

This stop if:
- It was traced back to something that was already an `InternedString`
- It was traced back to a `.to_string()` call
- It was in a persistent object creation

cc:
- @djc this is building on your work, I don't want to get in your way.
- @alexcrichton is this making things clearer and do you want to see a performance check?
@bors
Copy link
Contributor

bors commented Apr 4, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 29d9960 to master...

@bors bors merged commit 5c9d34b into rust-lang:master Apr 4, 2018
@Eh2406 Eh2406 deleted the InternMoreStrings branch May 10, 2018 17:49
@ehuss ehuss added this to the 1.27.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants