Skip to content

Add #[inline] to Vec's Deref/DerefMut #97553

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
Jun 1, 2022
Merged

Add #[inline] to Vec's Deref/DerefMut #97553

merged 1 commit into from
Jun 1, 2022

Conversation

nbdd0121
Copy link
Contributor

This should help #97552 (although I haven't verified).

@rust-highfive
Copy link
Contributor

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

@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label May 30, 2022
@rust-highfive
Copy link
Contributor

r? @Mark-Simulacrum

(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 May 30, 2022
@matthiaskrgr
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 May 30, 2022
@bors
Copy link
Collaborator

bors commented May 30, 2022

⌛ Trying commit 0a7a0ff with merge b20edec6d352b36b8e7bad706d8d60a33ba471a1...

@bors
Copy link
Collaborator

bors commented May 30, 2022

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

@rust-timer
Copy link
Collaborator

Queued b20edec6d352b36b8e7bad706d8d60a33ba471a1 with parent 946a88a, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (b20edec6d352b36b8e7bad706d8d60a33ba471a1): comparison url.

Instruction count

  • Primary benchmarks: mixed results
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions 😿
(primary)
0.5% 0.9% 8
Regressions 😿
(secondary)
0.3% 0.5% 18
Improvements 🎉
(primary)
-1.1% -1.7% 12
Improvements 🎉
(secondary)
-0.7% -1.0% 6
All 😿🎉 (primary) -0.5% -1.7% 20

Max RSS (memory usage)

Results
  • Primary benchmarks: mixed results
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions 😿
(primary)
5.8% 8.3% 2
Regressions 😿
(secondary)
2.2% 2.2% 1
Improvements 🎉
(primary)
-1.8% -2.4% 2
Improvements 🎉
(secondary)
-2.2% -2.7% 3
All 😿🎉 (primary) 2.0% 8.3% 4

Cycles

Results
  • Primary benchmarks: mixed results
  • Secondary benchmarks: 😿 relevant regression found
mean1 max count2
Regressions 😿
(primary)
3.7% 3.7% 1
Regressions 😿
(secondary)
2.6% 2.6% 1
Improvements 🎉
(primary)
-1.9% -1.9% 1
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) 0.9% 3.7% 2

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 may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf +perf-regression

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels May 30, 2022
@the8472
Copy link
Member

the8472 commented May 30, 2022

The linked_artifact numbers decrease for some full benchmarks (e.g. ripgrep and cargo). So even though more stuff gets inlined it produces less code, that's probably a good sign.

@klensy
Copy link
Contributor

klensy commented May 30, 2022

The linked_artifact numbers decrease for some full benchmarks (e.g. ripgrep and cargo). So even though more stuff gets inlined it produces less code, that's probably a good sign.

You can check few other perf runs and see, that changes in linked_artifact metric isn't rare (for example, there exist change even in #97489, which is pure rustdoc: https://perf.rust-lang.org/detailed-query.html?commit=855fc022fe879f4e3493a024f9c6b981d6317612&base_commit=6999ef25645dcfcfd4e7092e448385ab3b73e44c&benchmark=ripgrep-13.0.0-opt&scenario=full. Btw, why there any changes at all?)

@the8472
Copy link
Member

the8472 commented May 30, 2022

Well, they're 10x larger, but you're right, without knowing the variance it might still be noise.

@Mark-Simulacrum
Copy link
Member

I've personally seen this many times in local profiling, so I think it's worth doing this. Hopefully opaque pointers indeed fix this case though in the future.

@bors r+ rollup=never

@bors
Copy link
Collaborator

bors commented Jun 1, 2022

📌 Commit 0a7a0ff has been approved by Mark-Simulacrum

@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 Jun 1, 2022
@bors
Copy link
Collaborator

bors commented Jun 1, 2022

⌛ Testing commit 0a7a0ff with merge 395a09c...

@bors
Copy link
Collaborator

bors commented Jun 1, 2022

☀️ Test successful - checks-actions
Approved by: Mark-Simulacrum
Pushing 395a09c to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 1, 2022
@bors bors merged commit 395a09c into rust-lang:master Jun 1, 2022
@rustbot rustbot added this to the 1.63.0 milestone Jun 1, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (395a09c): comparison url.

Instruction count

  • Primary benchmarks: mixed results
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions 😿
(primary)
0.5% 0.8% 6
Regressions 😿
(secondary)
0.4% 0.7% 31
Improvements 🎉
(primary)
-1.2% -1.7% 10
Improvements 🎉
(secondary)
-1.1% -1.9% 10
All 😿🎉 (primary) -0.5% -1.7% 16

Max RSS (memory usage)

Results
  • Primary benchmarks: mixed results
  • Secondary benchmarks: 🎉 relevant improvement found
mean1 max count2
Regressions 😿
(primary)
2.4% 2.4% 1
Regressions 😿
(secondary)
N/A N/A 0
Improvements 🎉
(primary)
-1.4% -1.4% 1
Improvements 🎉
(secondary)
-4.1% -4.1% 1
All 😿🎉 (primary) 0.5% 2.4% 2

Cycles

Results
  • Primary benchmarks: mixed results
  • Secondary benchmarks: 😿 relevant regressions found
mean1 max count2
Regressions 😿
(primary)
3.1% 3.1% 1
Regressions 😿
(secondary)
2.4% 2.5% 3
Improvements 🎉
(primary)
-2.3% -3.4% 4
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) -1.2% -3.4% 5

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

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

@rylev
Copy link
Member

rylev commented Jun 7, 2022

As with any chance to inlining, performance is expected to change and to not always have a positive impact. That being said, the improvements outweigh the regressions (especially in primary benchmarks), and so it doesn't seem worth it to dig too much more into this.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Jun 7, 2022
@nbdd0121 nbdd0121 deleted the lib branch June 8, 2022 19:35
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. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. 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.

10 participants