-
Notifications
You must be signed in to change notification settings - Fork 67
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
Make gathering of dropped packets more efficient #182
Comments
Tried this with an The workaround is to collect the keys into a |
@jstnlef It looks like this has been refactored since this issue was created, so that link is no longer good. Any chance you can find and link to the new place where we're now unnecessarily allocating the |
@ncallaway the allocated vec can be found in the following places: https://github.com/amethyst/laminar/blob/master/src/net/virtual_connection.rs#L404 |
@BourgondAries:
It has drain_filter in nightly-only. Without it as an option we can use something like: pub fn dropped_packets(&mut self) -> Vec<SentPacket> {
let mut sent_sequences: Vec<SentPacket> = Vec::new();
let remote_ack_sequence = self.remote_ack_sequence_num;
self.sent_packets.retain(|key, value| {
if sequence_less_than(*key, remote_ack_sequence)
&& remote_ack_sequence.wrapping_sub(*key) > REDUNDANT_PACKET_ACKS_SIZE
{
sent_sequences.push(value.clone());
false
} else {
true
}
});
sent_sequences
} But it still leads to necessary using |
Task Description
Over here we allocate a new vector for dropped packets. In a perfect scenario, this should be avoided.
Task TODO
There is likely a way to set this up to just return a lazy iterator to prevent the vector allocation. It's worth exploring.
The text was updated successfully, but these errors were encountered: