-
Notifications
You must be signed in to change notification settings - Fork 13k
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 TrustedRandomAccess for in-place iterators where possible #79846
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
Copy
types to any type of same size.!Copy
types can't be optimized sinceTrustedRandomAccess
isn't implemented for those iterators.