-
Notifications
You must be signed in to change notification settings - Fork 13.3k
VecDeque::split_off has unexpectedly poor performance characteristics when splitting off from the front. #127281
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
…sal. r=dshin Using split_off to split the front chunk from the queue seems like it'd be efficient, but it's not: rust-lang/rust#127281 Instead, pass the range of nodes to distribute, and use VecDeque::from_iter in the callee. Then, just truncate() the queue to the remaining local work. Differential Revision: https://phabricator.services.mozilla.com/D215705
…sal. r=dshin Using split_off to split the front chunk from the queue seems like it'd be efficient, but it's not: rust-lang/rust#127281 Instead, pass the range of nodes to distribute, and use VecDeque::from_iter in the callee. Then, just truncate() the queue to the remaining local work. Differential Revision: https://phabricator.services.mozilla.com/D215705
…sal. r=dshin Using split_off to split the front chunk from the queue seems like it'd be efficient, but it's not: rust-lang/rust#127281 Instead, pass the range of nodes to distribute, and use VecDeque::from_iter in the callee. Then, just truncate() the queue to the remaining local work. Differential Revision: https://phabricator.services.mozilla.com/D215705
…sal. r=dshin, a=dmeehan Using split_off to split the front chunk from the queue seems like it'd be efficient, but it's not: rust-lang/rust#127281 Instead, pass the range of nodes to distribute, and use VecDeque::from_iter in the callee. Then, just truncate() the queue to the remaining local work. Differential Revision: https://phabricator.services.mozilla.com/D215705
…sal. r=dshin, a=dmeehan Using split_off to split the front chunk from the queue seems like it'd be efficient, but it's not: rust-lang/rust#127281 Instead, pass the range of nodes to distribute, and use VecDeque::from_iter in the callee. Then, just truncate() the queue to the remaining local work. Differential Revision: https://phabricator.services.mozilla.com/D215705
…sal. r=dshin, a=dmeehan Using split_off to split the front chunk from the queue seems like it'd be efficient, but it's not: rust-lang/rust#127281 Instead, pass the range of nodes to distribute, and use VecDeque::from_iter in the callee. Then, just truncate() the queue to the remaining local work. Differential Revision: https://phabricator.services.mozilla.com/D215705
…sal. r=dshin, a=dmeehan Using split_off to split the front chunk from the queue seems like it'd be efficient, but it's not: rust-lang/rust#127281 Instead, pass the range of nodes to distribute, and use VecDeque::from_iter in the callee. Then, just truncate() the queue to the remaining local work. Differential Revision: https://phabricator.services.mozilla.com/D215705
…sal. r=dshin, a=dmeehan Using split_off to split the front chunk from the queue seems like it'd be efficient, but it's not: rust-lang/rust#127281 Instead, pass the range of nodes to distribute, and use VecDeque::from_iter in the callee. Then, just truncate() the queue to the remaining local work. Differential Revision: https://phabricator.services.mozilla.com/D215705
If I understand, your expectation was that Note that the docs explicitly say "Returns a newly allocated We recently went over a similar case with |
Correct.
Yes, and I think that's unexpected. I agree it's documented :)
That would be reasonable. |
…sal. r=dshin, a=dmeehan Using split_off to split the front chunk from the queue seems like it'd be efficient, but it's not: rust-lang/rust#127281 Instead, pass the range of nodes to distribute, and use VecDeque::from_iter in the callee. Then, just truncate() the queue to the remaining local work. Differential Revision: https://phabricator.services.mozilla.com/D215705
I tried this code:
I expected the
FAST
branch and theelse
branch to have comparable performance, instead it seemsVecDeque::split_off
from the front is much slower than expected (as one would expect of e.g.Vec::split_off
which needs to shift all the elements).The text was updated successfully, but these errors were encountered: