mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 17:05:36 +00:00
e285fd6815
Replace optional<ProtoVarInt> + consumed pointer with ProtoVarIntResult struct that returns value + consumed count directly. This eliminates memory stores through a pointer on the fast path (single-byte varints < 128), keeping everything in registers. The parse() method is now ESPHOME_ALWAYS_INLINE with the multi-byte slow path outlined to parse_slow_(). The common case for protobuf field tags, small enums, booleans, and typical message sizes/types is a simple high-bit check + register return with no function call. Measured on ESP32 (Xtensa): try_read_frame_ grows only +12 bytes (320 → 332) for two inlined parse sites, while eliminating two function calls per message on the hot path.