Skip to content

Allow Vec's deref to be inlined #97330

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

Closed
wants to merge 1 commit into from
Closed

Allow Vec's deref to be inlined #97330

wants to merge 1 commit into from

Conversation

lqd
Copy link
Member

@lqd lqd commented May 23, 2022

This was hot in some local benchmarks, so let's see if this slight improvement will be interesting.

r? @ghost

@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label May 23, 2022
@lqd
Copy link
Member Author

lqd commented May 23, 2022

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

bors commented May 23, 2022

⌛ Trying commit 7d5b65e with merge 4bd1cca271443fd27fd0127d1671cbcfe9ba4757...

@thomcc
Copy link
Member

thomcc commented May 23, 2022

Hm, when I filed #96624 this was being inlined pretty reliably, so I'm surprised. (That said, I'm in favor of this change)

@bors
Copy link
Collaborator

bors commented May 23, 2022

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

@rust-timer
Copy link
Collaborator

Queued 4bd1cca271443fd27fd0127d1671cbcfe9ba4757 with parent 7f997f5, future comparison URL.

@lqd
Copy link
Member Author

lqd commented May 23, 2022

I had the same feeling, but was surprised it wasn't marked inline already when seeing it (expectedly) didn't inline with debug assertions, so I tried it. It did seem to make a difference on the cranelift-codegen and keccak benchmarks (without debug-assertions) and I wondered if it'd reproduce. We'll see.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (4bd1cca271443fd27fd0127d1671cbcfe9ba4757): comparison url.

Instruction count

  • Primary benchmarks: mixed results
  • Secondary benchmarks: mixed results
Regressions 😿
(primary)
Regressions 😿
(secondary)
Improvements 🎉
(primary)
Improvements 🎉
(secondary)
All 😿 🎉
(primary)
count1 23 19 14 12 37
mean2 0.8% 0.5% -1.0% -0.4% 0.1%
max 1.8% 0.7% -1.8% -0.4% 1.8%

Max RSS (memory usage)

Results
  • Primary benchmarks: mixed results
  • Secondary benchmarks: 😿 relevant regressions found
Regressions 😿
(primary)
Regressions 😿
(secondary)
Improvements 🎉
(primary)
Improvements 🎉
(secondary)
All 😿 🎉
(primary)
count1 1 5 2 0 3
mean2 4.4% 2.0% -1.6% N/A 0.4%
max 4.4% 3.9% -2.2% N/A 4.4%

Cycles

Results
  • Primary benchmarks: mixed results
  • Secondary benchmarks: mixed results
Regressions 😿
(primary)
Regressions 😿
(secondary)
Improvements 🎉
(primary)
Improvements 🎉
(secondary)
All 😿 🎉
(primary)
count1 1 2 9 3 10
mean2 1.5% 2.0% -1.8% -4.7% -1.5%
max 1.5% 2.6% -3.5% -5.0% -3.5%

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. number of relevant changes 2 3

  2. the arithmetic mean of the percent change 2 3

@rustbot rustbot added perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels May 23, 2022
@lqd
Copy link
Member Author

lqd commented May 24, 2022

This was more of a win locally:
image

Here, looking at check builds only to approximate runtime benchmarks, it looks like more of a regression instead. What do you think @thomcc ? Let's probably close it.

@thomcc
Copy link
Member

thomcc commented May 24, 2022

Yeah, this doesn't seem justified. Was worth a shot, though.

@lqd lqd closed this May 24, 2022
@lqd lqd deleted the vec-deref branch May 24, 2022 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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.

5 participants