-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 for_each to extend collections #59740
Conversation
This updates the `Extend` implementations to use `for_each` for many collections: `BinaryHeap`, `BTreeMap`, `BTreeSet`, `LinkedList`, `Path`, `TokenStream`, `VecDeque`, and `Wtf8Buf`. Folding with `for_each` enables better performance than a `for`-loop for some iterators, especially if they can just forward to internal iterators, like `Chain` and `FlatMap` do.
r? @TimNN (rust_highfive has picked a reviewer for you, use r? to override) |
For reference:
|
r? @scottmcm |
To get at least a sense that this isn't obviously bad (though I don't expect it to be), let's @bors try |
Use for_each to extend collections This updates the `Extend` implementations to use `for_each` for many collections: `BinaryHeap`, `BTreeMap`, `BTreeSet`, `LinkedList`, `Path`, `TokenStream`, `VecDeque`, and `Wtf8Buf`. Folding with `for_each` enables better performance than a `for`-loop for some iterators, especially if they can just forward to internal iterators, like `Chain` and `FlatMap` do.
r=me when perf is happy |
Actually, you might check for Line 1929 in 9ebf478
|
I see, the previous |
@scottmcm that one is difficult, because it wants to check |
☀️ Try build successful - checks-travis |
@rust-timer build eab4756 |
Success: Queued eab4756 with parent acd8dd6, comparison URL. |
Finished benchmarking try commit eab4756 |
📌 Commit 0730a01 has been approved by |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Use for_each to extend collections This updates the `Extend` implementations to use `for_each` for many collections: `BinaryHeap`, `BTreeMap`, `BTreeSet`, `LinkedList`, `Path`, `TokenStream`, `VecDeque`, and `Wtf8Buf`. Folding with `for_each` enables better performance than a `for`-loop for some iterators, especially if they can just forward to internal iterators, like `Chain` and `FlatMap` do.
Use for_each to extend collections This updates the `Extend` implementations to use `for_each` for many collections: `BinaryHeap`, `BTreeMap`, `BTreeSet`, `LinkedList`, `Path`, `TokenStream`, `VecDeque`, and `Wtf8Buf`. Folding with `for_each` enables better performance than a `for`-loop for some iterators, especially if they can just forward to internal iterators, like `Chain` and `FlatMap` do.
This updates the
Extend
implementations to usefor_each
for manycollections:
BinaryHeap
,BTreeMap
,BTreeSet
,LinkedList
,Path
,TokenStream
,VecDeque
, andWtf8Buf
.Folding with
for_each
enables better performance than afor
-loop forsome iterators, especially if they can just forward to internal
iterators, like
Chain
andFlatMap
do.