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

Use AttrVec more #100668

Merged
merged 1 commit into from
Aug 22, 2022
Merged

Use AttrVec more #100668

merged 1 commit into from
Aug 22, 2022

Conversation

nnethercote
Copy link
Contributor

@nnethercote nnethercote commented Aug 17, 2022

In some places we use Vec<Attribute> and some places we use
ThinVec<Attribute> (a.k.a. AttrVec). This results in various points
where we have to convert between Vec and ThinVec.

This commit changes the places that use Vec<Attribute> to use
AttrVec. A lot of this is mechanical and boring, but there are
some interesting parts:

  • It adds a few new methods to ThinVec.
  • It implements MapInPlace for ThinVec, and introduces a macro to
    avoid the repetition of this trait for Vec, SmallVec, and
    ThinVec.

Overall, it makes the code a little nicer, and has little effect on
performance. But it is a precursor to removing
rustc_data_structures::ThinVec and replacing it with
thin_vec::ThinVec, which is implemented more efficiently.

r? @spastorino

@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Aug 17, 2022
@rustbot
Copy link
Collaborator

rustbot commented Aug 17, 2022

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

Some changes occurred in src/librustdoc/clean/types.rs

cc @camelid

@nnethercote
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 Aug 17, 2022
@bors
Copy link
Contributor

bors commented Aug 17, 2022

⌛ Trying commit 10127a2e4f63aac6abbfe354a60bca49e700b4b5 with merge ea19f197d57a419f4310951e073202e05bbe3615...

@rust-log-analyzer

This comment has been minimized.

@nnethercote
Copy link
Contributor Author

rustc exited with signal: 4 (SIGILL) (core dumped)

SIGILL here too? Is this from my changes (I haven't touched any unsafe code, or done anything unusual) or am I hitting some pre-existing problem? #100669, which cuts this PR back even more, will hopefully indicate one way or the other.

@bors
Copy link
Contributor

bors commented Aug 17, 2022

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

@rust-timer
Copy link
Collaborator

Queued ea19f197d57a419f4310951e073202e05bbe3615 with parent 86c6ebe, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ea19f197d57a419f4310951e073202e05bbe3615): comparison url.

Instruction count

  • Primary benchmarks: mixed results
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions ❌
(primary)
0.4% 1.0% 5
Regressions ❌
(secondary)
0.6% 1.1% 14
Improvements ✅
(primary)
-0.6% -0.9% 4
Improvements ✅
(secondary)
-0.5% -0.9% 21
All ❌✅ (primary) -0.0% 1.0% 9

Max RSS (memory usage)

Results
  • Primary benchmarks: mixed results
  • Secondary benchmarks: ✅ relevant improvements found
mean1 max count2
Regressions ❌
(primary)
2.5% 2.5% 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.9% -1.2% 2
Improvements ✅
(secondary)
-2.3% -3.2% 5
All ❌✅ (primary) 0.2% 2.5% 3

Cycles

Results
  • Primary benchmarks: ❌ relevant regressions found
  • Secondary benchmarks: no relevant changes found
mean1 max count2
Regressions ❌
(primary)
6.1% 14.5% 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 6.1% 14.5% 3

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. 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 Aug 17, 2022
@nnethercote
Copy link
Contributor Author

@spastorino: you've already reviewed the first three commits in #100669, so only the fourth commit needs reviewing. Thanks!

@nnethercote
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 Aug 18, 2022
@bors
Copy link
Contributor

bors commented Aug 18, 2022

⌛ Trying commit ae79c3d4a81f3afec7ed78e756603011982eda7f with merge 7fa2c81cd586f461cc05f8a9268da92fc3a8c1b0...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Aug 18, 2022

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

@rust-timer
Copy link
Collaborator

Queued 7fa2c81cd586f461cc05f8a9268da92fc3a8c1b0 with parent 9c20b2a, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7fa2c81cd586f461cc05f8a9268da92fc3a8c1b0): comparison url.

Instruction count

  • Primary benchmarks: mixed results
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions ❌
(primary)
0.7% 1.0% 3
Regressions ❌
(secondary)
0.6% 0.8% 10
Improvements ✅
(primary)
-0.6% -1.0% 4
Improvements ✅
(secondary)
-0.5% -1.0% 23
All ❌✅ (primary) -0.1% 1.0% 7

Max RSS (memory usage)

Results
  • Primary benchmarks: ✅ relevant improvements found
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.3% 2.4% 4
Improvements ✅
(primary)
-1.7% -3.4% 5
Improvements ✅
(secondary)
-1.9% -2.8% 7
All ❌✅ (primary) -1.7% -3.4% 5

Cycles

Results
  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.9% 2.9% 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.3% -2.6% 6
All ❌✅ (primary) - - 0

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 removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 18, 2022
@spastorino
Copy link
Member

@nnethercote r=me after rebasing

@nnethercote
Copy link
Contributor Author

I have rebased. Although this is very close to performance-neutral, I will leave it as rollup=never because it has enough of an effect on performance (with improvements and regressions balancing out) that it shouldn't be part of a rollup.

@bors r=spastorino

@bors
Copy link
Contributor

bors commented Aug 18, 2022

📌 Commit 9bd705836a272e21e2fbc4e95b5ec39906c9abb0 has been approved by spastorino

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 Aug 18, 2022
@bors
Copy link
Contributor

bors commented Aug 20, 2022

☔ The latest upstream changes (presumably #100564) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 20, 2022
In some places we use `Vec<Attribute>` and some places we use
`ThinVec<Attribute>` (a.k.a. `AttrVec`). This results in various points
where we have to convert between `Vec` and `ThinVec`.

This commit changes the places that use `Vec<Attribute>` to use
`AttrVec`. A lot of this is mechanical and boring, but there are
some interesting parts:
- It adds a few new methods to `ThinVec`.
- It implements `MapInPlace` for `ThinVec`, and introduces a macro to
  avoid the repetition of this trait for `Vec`, `SmallVec`, and
  `ThinVec`.

Overall, it makes the code a little nicer, and has little effect on
performance. But it is a precursor to removing
`rustc_data_structures::thin_vec::ThinVec` and replacing it with
`thin_vec::ThinVec`, which is implemented more efficiently.
@nnethercote
Copy link
Contributor Author

Rebased.

@bors r=spastorino

@bors
Copy link
Contributor

bors commented Aug 21, 2022

📌 Commit 619b8ab has been approved by spastorino

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 21, 2022
@bors
Copy link
Contributor

bors commented Aug 22, 2022

⌛ Testing commit 619b8ab with merge 3ce46b7...

@bors
Copy link
Contributor

bors commented Aug 22, 2022

☀️ Test successful - checks-actions
Approved by: spastorino
Pushing 3ce46b7 to master...

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3ce46b7): comparison url.

Instruction count

  • Primary benchmarks: mixed results
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions ❌
(primary)
0.6% 1.0% 2
Regressions ❌
(secondary)
0.6% 1.3% 8
Improvements ✅
(primary)
-0.3% -0.4% 7
Improvements ✅
(secondary)
-0.5% -1.2% 15
All ❌✅ (primary) -0.1% 1.0% 9

Max RSS (memory usage)

Results
  • Primary benchmarks: ✅ relevant improvements found
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.7% 4.2% 8
Improvements ✅
(primary)
-2.0% -3.9% 4
Improvements ✅
(secondary)
-1.7% -2.2% 4
All ❌✅ (primary) -2.0% -3.9% 4

Cycles

Results
  • Primary benchmarks: ❌ relevant regression found
  • Secondary benchmarks: ❌ relevant regression found
mean1 max count2
Regressions ❌
(primary)
2.4% 2.4% 1
Regressions ❌
(secondary)
2.5% 2.5% 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.4% 2.4% 1

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
cc @rust-lang/wg-compiler-performance

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

@nnethercote
Copy link
Contributor Author

As seen above, there are a few small wins and losses here, which balance each other out, and the net effect is perf-neutral.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Aug 22, 2022
@nnethercote nnethercote deleted the use-AttrVec-more branch August 22, 2022 04:47
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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants