From ed4c2cc8be0c233f37e1ba3ca3f953e07fc2b720 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 28 Oct 2025 22:13:07 -0500 Subject: [PATCH] [api] Optimize protobuf varint encoding for flash savings --- esphome/components/api/proto.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/esphome/components/api/proto.h b/esphome/components/api/proto.h index f68ef330f6..045e424abf 100644 --- a/esphome/components/api/proto.h +++ b/esphome/components/api/proto.h @@ -221,7 +221,8 @@ class ProtoWriteBuffer { void write(uint8_t value) { this->buffer_->push_back(value); } // Single implementation that all overloads delegate to - void encode_varint(uint64_t value) { + // Mark noinline to prevent code bloat from inlining into every caller + __attribute__((noinline)) void encode_varint(uint64_t value) { auto buffer = this->buffer_; size_t start = buffer->size();