[api] Use large socket buffers and remove mid-loop draining

Increase socket buffer to 16MB so benchmarks never hit WOULD_BLOCK
during an inner loop iteration. Remove per-iteration drain_socket
calls that were adding noise and causing the immediate path to
fall back to batching. Drain only between outer iterations.
This commit is contained in:
J. Nick Koston
2026-04-01 08:54:30 -10:00
parent f469a7ced2
commit d717c7b46c
3 changed files with 3 additions and 18 deletions
@@ -49,9 +49,6 @@ static void PlaintextFrame_WriteSensorState(benchmark::State &state) {
msg.encode(writer);
helper->write_protobuf_packet(SensorStateResponse::MESSAGE_TYPE, writer);
if ((i & 0xFF) == 0)
drain_socket(read_fd);
}
drain_socket(read_fd);
benchmark::DoNotOptimize(helper.get());
@@ -96,9 +93,6 @@ static void PlaintextFrame_WriteBatch5(benchmark::State &state) {
}
helper->write_protobuf_messages(ProtoWriteBuffer(&buffer, 0), std::span<const MessageInfo>(messages, 5));
if ((i & 0xFF) == 0)
drain_socket(read_fd);
}
drain_socket(read_fd);
benchmark::DoNotOptimize(helper.get());