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 Iterator as IntoIterator. #84560

Merged
merged 1 commit into from
Jul 5, 2021
Merged

Conversation

cjgillot
Copy link
Contributor

For some reason, it appears on rustc's own perf stats.

@rust-highfive
Copy link
Collaborator

r? @kennytm

(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 Apr 25, 2021
@cjgillot
Copy link
Contributor Author

@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 Apr 25, 2021
@bors
Copy link
Contributor

bors commented Apr 25, 2021

⌛ Trying commit dc9ec33bf2c1b92bc051961e079c5440d6a92464 with merge d0dc8fa09dd3783218e63ad10397019d079f7476...

@bors
Copy link
Contributor

bors commented Apr 25, 2021

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

@rust-timer
Copy link
Collaborator

Queued d0dc8fa09dd3783218e63ad10397019d079f7476 with parent 58bdb08, future comparison URL.

@Mark-Simulacrum
Copy link
Member

For some reason, it appears on rustc's own perf stats.

Can you say more about this? Is this perhaps with incremental on, or without cgu=1 for std? I would expect ThinLTO without incremental to already give LLVM the ability to inline it away..

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (d0dc8fa09dd3783218e63ad10397019d079f7476): comparison url.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying rollup- to bors.

Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up.

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

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 25, 2021
@kennytm
Copy link
Member

kennytm commented Apr 26, 2021

Perf looks worse in general.

@m-ou-se
Copy link
Member

m-ou-se commented Apr 26, 2021

Note that we rarely use #[inline(always)] in the standard library. #[inline] is pretty much always sufficient.

@cjgillot
Copy link
Contributor Author

Instruction perf is noisy, and a regression overall.
Max-RSS perf is improved up to 3%.

Changed to a simple #[inline].

@bstrie
Copy link
Contributor

bstrie commented May 12, 2021

Is this waiting for a timer run?

@bstrie bstrie added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 12, 2021
@cjgillot
Copy link
Contributor Author

@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 20, 2021
@bors
Copy link
Contributor

bors commented May 20, 2021

⌛ Trying commit 15c8a0e with merge 9055b756be00e7347a6487b5ce074c405c971c09...

@cjgillot cjgillot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 20, 2021
@bors
Copy link
Contributor

bors commented May 20, 2021

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

@rust-timer
Copy link
Collaborator

Queued 9055b756be00e7347a6487b5ce074c405c971c09 with parent 9a3214e, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (9055b756be00e7347a6487b5ce074c405c971c09): comparison url.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying rollup- to bors.

Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up.

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

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 20, 2021
@bjorn3
Copy link
Member

bjorn3 commented May 21, 2021

Nice improvements up to 4.6%. A regression of 6.2% on webrender-opt incr-patched and 4.2% for html5ever-opt full and piston-image-opt full. No other regression >0.5%.

@crlf0710 crlf0710 added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 11, 2021
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 27, 2021
@jackh726 jackh726 added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Jul 3, 2021
@m-ou-se m-ou-se added T-libs Relevant to the library team, which will review and decide on the PR/issue. and removed T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jul 5, 2021
@m-ou-se
Copy link
Member

m-ou-se commented Jul 5, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Jul 5, 2021

📌 Commit 15c8a0e has been approved by m-ou-se

@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 5, 2021
@m-ou-se m-ou-se assigned m-ou-se and unassigned kennytm Jul 5, 2021
@bors
Copy link
Contributor

bors commented Jul 5, 2021

⌛ Testing commit 15c8a0e with merge 6e9b369...

@bors
Copy link
Contributor

bors commented Jul 5, 2021

☀️ Test successful - checks-actions
Approved by: m-ou-se
Pushing 6e9b369 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 5, 2021
@bors bors merged commit 6e9b369 into rust-lang:master Jul 5, 2021
@rustbot rustbot added this to the 1.55.0 milestone Jul 5, 2021
@cjgillot cjgillot deleted the inline-iter branch July 5, 2021 19:31
@rylev
Copy link
Member

rylev commented Jul 6, 2021

This change led to moderate performance regressions along with some performance gains.

For changes that impact inlining, we should probably be in the habit of running performance tests.

As part of the performance triage process, I'm marking this as a performance regression. If you believe this performance regression to be justifiable or once you have an issue or PR that addresses this regression, please mark this PR with the label perf-regression-triaged.

@rustbot label +perf-regression

@Mark-Simulacrum
Copy link
Member

I took a look at this regression.

For webrender-opt println incr, it looks like this change led to an extra LLVM module being regenerated, presumably due to inlining this impl shuffling some modules around. Not unexpected for this kind of change, and generally an acceptable loss, particularly given the impact to just one benchmark.

The piston image "full" benchmark also had an additional LLVM module, which is a little interesting -- this benchmark isn't incremental -- but likely the cause is somewhat similar. (Bumping to one more LLVM module).

These regressions are coupled with several cycles:u improvements in a number of stress tests, so I would say that they are largely justified. The instruction counts for this change are unlikely to be particularly interesting -- we're only saving an instruction here and there from avoiding a function call, most likely -- but the extra inlining does seem to bring some benefits to compiler performance.

As such, marking as triaged -- no further action warranted. @rustbot label +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Sep 15, 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. 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.