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 &IndexSlice instead of &IndexVec where possible #109819

Merged
merged 1 commit into from
Apr 3, 2023

Conversation

scottmcm
Copy link
Member

All the same reasons as for [T]: more general, less pointer chasing, and &mut IndexSlice emphasizes that it doesn't change length.

r? @ghost

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 31, 2023
@rustbot
Copy link
Collaborator

rustbot commented Mar 31, 2023

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@scottmcm scottmcm 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 Mar 31, 2023
@scottmcm scottmcm force-pushed the index-slice branch 2 times, most recently from 77c9298 to b47b43b Compare March 31, 2023 17:17
@scottmcm
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 31, 2023
@bors
Copy link
Contributor

bors commented Mar 31, 2023

⌛ Trying commit b47b43b4f22bfb374597a0c8e8b683970867776d with merge 0e80712d44f9e728430eba2130bb30f813c99ad1...

@bors
Copy link
Contributor

bors commented Mar 31, 2023

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (0e80712d44f9e728430eba2130bb30f813c99ad1): comparison URL.

Overall result: ✅ improvements - no action needed

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.

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

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.3% [-0.3%, -0.3%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.0% [1.8%, 2.1%] 2
Improvements ✅
(primary)
-3.3% [-3.3%, -3.3%] 1
Improvements ✅
(secondary)
-2.9% [-3.3%, -2.5%] 2
All ❌✅ (primary) -3.3% [-3.3%, -3.3%] 1

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
5.3% [4.9%, 5.4%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 31, 2023
@scottmcm
Copy link
Member Author

r? @WaffleLapkin
@rustbot ready

@rustbot rustbot 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 Mar 31, 2023
All the same reasons as for `[T]`: more general, less pointer chasing, and `&mut IndexSlice` emphasizes that it doesn't change *length*.
@scottmcm
Copy link
Member Author

scottmcm commented Apr 3, 2023

(Update was just a rebase atop #109849, since it touched a couple of the same places.)

@@ -116,7 +130,7 @@ impl<I: Idx, T> IndexVec<I, T> {
}

#[inline]
pub fn from_elem<S>(elem: T, universe: &IndexVec<I, S>) -> Self
pub fn from_elem<S>(elem: T, universe: &IndexSlice<I, S>) -> Self
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have documentation here, I don't really get why/how you'd use this method...

Copy link
Member Author

@scottmcm scottmcm Apr 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sent as PR #109913

@WaffleLapkin
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Apr 3, 2023

📌 Commit a2ee759 has been approved by WaffleLapkin

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 Apr 3, 2023
@bors
Copy link
Contributor

bors commented Apr 3, 2023

⌛ Testing commit a2ee759 with merge bf41e75...

@bors
Copy link
Contributor

bors commented Apr 3, 2023

☀️ Test successful - checks-actions
Approved by: WaffleLapkin
Pushing bf41e75 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 3, 2023
@bors bors merged commit bf41e75 into rust-lang:master Apr 3, 2023
@rustbot rustbot added this to the 1.70.0 milestone Apr 3, 2023
@scottmcm scottmcm deleted the index-slice branch April 3, 2023 20:52
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (bf41e75): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.2% [0.2%, 0.2%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.9% [-1.2%, -0.5%] 6
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
3.4% [3.4%, 3.4%] 1
Regressions ❌
(secondary)
0.8% [0.8%, 0.8%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.8% [-2.8%, -2.8%] 1
All ❌✅ (primary) 3.4% [3.4%, 3.4%] 1

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.0% [-2.0%, -1.9%] 2
All ❌✅ (primary) - - 0

aliemjay added a commit to aliemjay/rust that referenced this pull request Apr 4, 2023
Doc-comment  `IndexVec::from_elem` and use it in a few more places

Since this PR is a reply to rust-lang#109819 (comment),
r? `@WaffleLapkin`
compiler-errors added a commit to compiler-errors/rust that referenced this pull request Apr 4, 2023
Doc-comment  `IndexVec::from_elem` and use it in a few more places

Since this PR is a reply to rust-lang#109819 (comment),
r? ``@WaffleLapkin``
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. 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.

5 participants