mirror of
https://github.com/esphome/esphome.git
synced 2026-03-24 06:53:07 +08:00
decode() is never called polymorphically - all call sites in read_message_() use concrete types. The only indirect call site was decode_to_message(), which also always knows the concrete type. Convert decode_to_message() to a template so the concrete type is preserved, allowing decode() to be non-virtual. The two classes that override decode() (ExecuteServiceArgument, ExecuteServiceRequest) now hide the base method, which works since all calls use concrete types. This removes one vtable slot (4 bytes) from each decodable message class vtable, saving ~148 bytes of flash.