mirror of
https://github.com/esphome/esphome.git
synced 2026-10-04 02:05:59 +00:00
[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:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user