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

Inline Windows OsStrExt::encode_wide #97841

Merged
merged 1 commit into from
Jul 11, 2022
Merged

Conversation

nvzqz
Copy link
Contributor

@nvzqz nvzqz commented Jun 7, 2022

User crates currently produce much more code than necessary because the optimizer fails to make assumptions about this method.

User crates currently produce much more code than necessary because the
optimizer fails to make assumptions about this method.
@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Jun 7, 2022
@rust-highfive
Copy link
Collaborator

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 r? rust-lang/libs-api @rustbot label +T-libs-api -T-libs to request review from a libs-api team reviewer. 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

@rust-highfive
Copy link
Collaborator

r? @joshtriplett

(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 Jun 7, 2022
@nvzqz
Copy link
Contributor Author

nvzqz commented Jun 16, 2022

friendly reminder @joshtriplett

@JohnTitor
Copy link
Member

Do you have any result that shows this inlining is helpful e.g. generated assembly?

@thomcc
Copy link
Member

thomcc commented Jul 11, 2022

Inlining iterator constructors does tend to be beneficial, as it's required to constant fold anything having to do with the iterator, and allows propagation of checks (for example, if a length check exists prior to construction of the iterator, the compiler only knows that continues to hold if the construction of the iterator is inlined). They also tend to be small, as this one looks to be.

As a non-generic stdlib function, I wouldn't expect this to get inlined without this, and it doesn't https://rust.godbolt.org/z/4xf8d1T6h. So I think this is fine, and am going to accept it.

@bors r+

@bors
Copy link
Contributor

bors commented Jul 11, 2022

📌 Commit 246a80c has been approved by thomcc

It is now in the queue for this repository.

@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 Jul 11, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jul 11, 2022
Inline Windows `OsStrExt::encode_wide`

User crates currently produce much more code than necessary because the optimizer fails to make assumptions about this method.
@bors
Copy link
Contributor

bors commented Jul 11, 2022

⌛ Testing commit 246a80c with merge 7d1f57a...

@bors
Copy link
Contributor

bors commented Jul 11, 2022

☀️ Test successful - checks-actions
Approved by: thomcc
Pushing 7d1f57a to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 11, 2022
@bors bors merged commit 7d1f57a into rust-lang:master Jul 11, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jul 11, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7d1f57a): comparison url.

Instruction count

  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: 😿 relevant regressions found
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
1.6% 1.8% 6
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) N/A N/A 0

Max RSS (memory usage)

Results
  • Primary benchmarks: 🎉 relevant improvement found
  • Secondary benchmarks: 🎉 relevant improvement found
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
N/A N/A 0
Improvements 🎉
(primary)
-2.9% -2.9% 1
Improvements 🎉
(secondary)
-3.8% -3.8% 1
All 😿🎉 (primary) -2.9% -2.9% 1

Cycles

Results
  • Primary benchmarks: 😿 relevant regression found
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions 😿
(primary)
2.9% 2.9% 1
Regressions 😿
(secondary)
4.5% 6.7% 2
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
-3.8% -4.5% 2
All 😿🎉 (primary) 2.9% 2.9% 1

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

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-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.

8 participants