Skip to content

Use <[T; N]>::map in Sharded instead of SmallVec and unsafe code #89069

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
Sep 20, 2021

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Sep 18, 2021

This results in a lot less assembly

@bjorn3 bjorn3 added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 18, 2021
@rust-highfive
Copy link
Contributor

r? @davidtwco

(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 Sep 18, 2021
@bjorn3
Copy link
Member Author

bjorn3 commented Sep 18, 2021

@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 Sep 18, 2021
@bors
Copy link
Collaborator

bors commented Sep 18, 2021

⌛ Trying commit 7b50fd5 with merge d7e5e4ab57e3fa2aca41f679c8baab3581926670...

@Mark-Simulacrum
Copy link
Member

Probably doesn't matter too much for perf - I don't think we frequently initialize Sharded - but r=me, seems like a good improvement if perf is good.

@bors
Copy link
Collaborator

bors commented Sep 18, 2021

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

@rust-timer
Copy link
Collaborator

Queued d7e5e4ab57e3fa2aca41f679c8baab3581926670 with parent 6cdd42f, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (d7e5e4ab57e3fa2aca41f679c8baab3581926670): comparison url.

Summary: This change led to moderate relevant mixed results 🤷 in compiler performance.

  • Moderate improvement in instruction counts (up to -1.4% on incr-unchanged builds of ctfe-stress-4)
  • Moderate regression in instruction counts (up to 0.7% on incr-patched: println builds of coercions)

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

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Sep 18, 2021
@bjorn3
Copy link
Member Author

bjorn3 commented Sep 18, 2021

A couple of regressions, mostly improvements.

@Mark-Simulacrum
Copy link
Member

Looking at a cachegrind diff locally, the regression seems to be caused by noise rather than something genuine -- I'm seeing a bump in the number of instructions used for PartialEq ConstKind not equals, which seems pretty unrelated to this change, and some LLVM functions. Ultimately doesn't seem like this is something we can address and the change does bring a win on both how simple the code is and bootstrap compilation time.

@rustbot label +perf-regression-triaged

@bors r+

@bors
Copy link
Collaborator

bors commented Sep 20, 2021

📌 Commit 7b50fd5 has been approved by Mark-Simulacrum

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Sep 20, 2021
@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 Sep 20, 2021
@bors
Copy link
Collaborator

bors commented Sep 20, 2021

⌛ Testing commit 7b50fd5 with merge 3bb9eec...

@bors
Copy link
Collaborator

bors commented Sep 20, 2021

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 20, 2021
@bors bors merged commit 3bb9eec into rust-lang:master Sep 20, 2021
@rustbot rustbot added this to the 1.57.0 milestone Sep 20, 2021
@bjorn3 bjorn3 deleted the optimize_sharded_new branch September 20, 2021 17:40
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3bb9eec): comparison url.

Summary: This change led to large relevant mixed results 🤷 in compiler performance.

  • Moderate improvement in instruction counts (up to -1.1% on full builds of coercions)
  • Large regression in instruction counts (up to 2.8% on incr-full builds of ctfe-stress-4)

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

@pnkfelix
Copy link
Member

Visiting for performance triage.

The report from when this PR was first timed looks pretty different from the report from when it landed.

But either way, I'm inclined to apply @Mark-Simulacrum 's analysis above.

@rustbot label: +perf-regression-triaged

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-compiler Relevant to the compiler 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