Use TrustedRandomAccess for in-place iterators where possible#79846
Use TrustedRandomAccess for in-place iterators where possible#79846bors merged 4 commits intorust-lang:masterfrom
Conversation
|
(rust-highfive has picked a reviewer for you, use r? to override) |
|
|
I assume that was due to the older LLVM version, I added a min requirement to the codegen test since this is just an optimization. |
|
@bors try @rust-timer queue |
|
Awaiting bors try build completion |
|
⌛ Trying commit 04cda95ab5f7ebb4d734ff3e94124159e7f1ab61 with merge 35e08efe204c0d413365fe2031938e476418f692... |
|
☀️ Try build successful - checks-actions |
|
Queued 35e08efe204c0d413365fe2031938e476418f692 with parent c16d52d, future comparison URL. |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking try commit (35e08efe204c0d413365fe2031938e476418f692): 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 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 |
|
syn-opt is noisy so we can probably ignore that, other than that a few tiny improvements. |
|
☔ The latest upstream changes (presumably #80530) made this pull request unmergeable. Please resolve the merge conflicts. |
8e23a6d to
783fa23
Compare
This comment has been minimized.
This comment has been minimized.
e3d7764 to
ad2fe3e
Compare
|
r? @m-ou-se |
|
@bors r+ |
|
📌 Commit 5c9c5bd5807bef81f9989728d00a6985f4375e55 has been approved by |
|
⌛ Testing commit 5c9c5bd5807bef81f9989728d00a6985f4375e55 with merge 8435e466f5bdc06e9cf3a01f84be762629981f8b... |
This comment has been minimized.
This comment has been minimized.
|
💔 Test failed - checks-actions |
This allows the optimizer to turn certain iterator pipelines such as ```rust let vec = vec![0usize; 100]; vec.into_iter().map(|e| e as isize).collect::<Vec<_>>() ``` into a noop. The optimization only applies when iterator sources are `T: Copy` since `impl TrustedRandomAccess for IntoIter<T>`. No such requirement applies to the output type (`Iterator::Item`).
|
@bors r+ |
|
📌 Commit 2d8be45 has been approved by |
|
☀️ Test successful - checks-actions |
This can speed up in-place iterators containing simple casts and transmutes from
Copytypes to any type of same size.!Copytypes can't be optimized sinceTrustedRandomAccessisn't implemented for those iterators.