mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-08-08 09:42:06 +03:00
Call Clock::now only once in writeConnectionDataToSocket
Summary: The time between iterations is not significant, so we can just call `Clock::now` once in the beginning and reuse the same value. I ran a canary with some counters to get an idea of the amount of time between the start of the first iteration and the end of the last iteration (see D57510979), and: * Edge p100: 1500 us * olb p100: 1900 us * Edge p99: 413 us * olb p99: 396 us The wins we're seeing are 0.13% relative CPU. Reviewed By: kvtsoy Differential Revision: D57594650 fbshipit-source-id: 9d0f827564179745cd83eb6ca211df68d3f23f8b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3240f33387
commit
d75b6e70cc
@@ -1529,6 +1529,8 @@ WriteQuicDataResult writeConnectionDataToSocket(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
quic::TimePoint sentTime = Clock::now();
|
||||||
|
|
||||||
while (scheduler.hasData() && ioBufBatch.getPktSent() < packetLimit &&
|
while (scheduler.hasData() && ioBufBatch.getPktSent() < packetLimit &&
|
||||||
((ioBufBatch.getPktSent() < batchSize) ||
|
((ioBufBatch.getPktSent() < batchSize) ||
|
||||||
writeLoopTimeLimit(writeLoopBeginTime, connection))) {
|
writeLoopTimeLimit(writeLoopBeginTime, connection))) {
|
||||||
@@ -1581,7 +1583,7 @@ WriteQuicDataResult writeConnectionDataToSocket(
|
|||||||
connection,
|
connection,
|
||||||
std::move(result->packetEvent),
|
std::move(result->packetEvent),
|
||||||
std::move(result->packet->packet),
|
std::move(result->packet->packet),
|
||||||
Clock::now(),
|
sentTime,
|
||||||
folly::to<uint32_t>(ret.encodedSize),
|
folly::to<uint32_t>(ret.encodedSize),
|
||||||
folly::to<uint32_t>(ret.encodedBodySize),
|
folly::to<uint32_t>(ret.encodedBodySize),
|
||||||
false /* isDSRPacket */);
|
false /* isDSRPacket */);
|
||||||
|
Reference in New Issue
Block a user