quinn icon indicating copy to clipboard operation
quinn copied to clipboard

Optimize PacketSpace::sent_packets

Open Ralith opened this issue 4 years ago • 1 comments

@Matthias247 reports that this is a performance bottleneck. It's currently a BTreeMap of packet numbers to frame metadata, and the required operations are append and random erase. The maximum size is roughly bounded by the round-trip time of the connection, since we declare packets lost and remove them from the list after an ACK is received for a packet number greater than that of the packet in question by more than the reordering threshold. Most removals are from the front, rather than the middle.

A good replacement would be a VecDeque<Vec<(u64, SentPacket)>>, where each inner Vec is at most a fixed size, and both levels are sorted by packet number.

Ralith avatar May 01 '21 22:05 Ralith

Just to ack (ha!) that I just did some profiling and this definitely shows up in profiles.

alessandrod avatar May 09 '22 05:05 alessandrod