mirror of
https://github.com/esphome/esphome.git
synced 2026-09-11 15:27:33 +00:00
bcdb384bbe48ff4d686ca0ff5dcc3bfc75bde99d
Every decodable message overrode up to three virtuals, one per wire type, so each carried a five slot vtable and up to three functions with their own prologue and return tails. The shared decode loop now parses the payload for the wire type into a ProtoFieldValue and calls a single decode_field() virtual with the tag, the field number and the wire type; the generated override is one switch. The switch key is chosen per target through PROTO_DECODE_KEY. Embedded builds compile switches to compare chains (ESP-IDF passes -fno-jump-tables), so they key on the full wire tag, one compare per field with no separate wire type check. The host compiler builds a jump table for the dense field number switch, so there the key is the field number and PROTO_DECODE_GUARD rejects a mismatched wire type. Both forms drop a field that arrives with a wire type it does not declare, exactly as the per wire type virtuals did. Per decodable message the vtable shrinks from 20 to 12 bytes on xtensa and the extra decode functions fold into one; the shared loop shrinks as well. Host instruction counts per decoded field are unchanged apart from the guard compare, which replaces the prologue of the separate function it used to call.
Description
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
Readme
Multiple Licenses
593 MiB
Languages
C++
55.8%
Python
43.6%
C
0.3%
JavaScript
0.2%
