1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-08-06 22:22:38 +03:00

Optimize ACK frame writing

Summary:
Previously we stored an `IntervalSet` in each `WriteAckFrame`. We don't need to do this, as by the time we are writing an `ACK` the `IntervalSet` is complete. Instead of bothering with the `IntervalSet` operations, we can simply serialize it to a reverse-sorted `vector.`

Additionally this has some micro-optimizations for filling the ACK frame, with a new function for getting varint size.

Reviewed By: yangchi

Differential Revision: D19397728

fbshipit-source-id: ba6958fb36a4681edaa8394b1bcbbec3472e177d
This commit is contained in:
Matt Joras
2020-01-16 10:39:17 -08:00
committed by Facebook Github Bot
parent 6cefc60e8d
commit 431acc838f
22 changed files with 151 additions and 114 deletions

View File

@@ -545,7 +545,7 @@ TEST_F(QuicTransportFunctionsTest, TestUpdateConnectionPureAckCounter) {
packetEncodedSize += packet.body ? packet.body->computeChainDataLength() : 0;
WriteAckFrame ackFrame;
ackFrame.ackBlocks.insert(100);
ackFrame.ackBlocks.emplace_back(0, 100);
packet.packet.frames.push_back(std::move(ackFrame));
updateConnection(
*conn, folly::none, packet.packet, TimePoint(), getEncodedSize(packet));
@@ -591,7 +591,7 @@ TEST_F(QuicTransportFunctionsTest, TestPaddingPureAckPacketIsStillPureAck) {
packetEncodedSize += packet.body ? packet.body->computeChainDataLength() : 0;
WriteAckFrame ackFrame;
ackFrame.ackBlocks.insert(100);
ackFrame.ackBlocks.emplace_back(0, 100);
packet.packet.frames.push_back(std::move(ackFrame));
packet.packet.frames.push_back(PaddingFrame());
updateConnection(
@@ -762,7 +762,7 @@ TEST_F(QuicTransportFunctionsTest, TestUpdateConnectionWithPureAck) {
conn->congestionController = std::move(mockCongestionController);
ASSERT_EQ(0, conn->lossState.totalBytesAcked);
WriteAckFrame ackFrame;
ackFrame.ackBlocks.insert(10);
ackFrame.ackBlocks.emplace_back(0, 10);
packet.packet.frames.push_back(std::move(ackFrame));
EXPECT_CALL(*rawController, onPacketSent(_)).Times(0);
EXPECT_CALL(*rawPacer, onPacketSent()).Times(0);