mirror of
https://github.com/esphome/esphome.git
synced 2026-09-21 12:08:38 +00:00
Replace the LogListener abstract class (single pure virtual method) with a lightweight LogCallback struct containing a function pointer + instance pointer. This eliminates a vtable sub-table and thunk from every class that previously inherited LogListener. Savings per former LogListener implementer: - 12 bytes vtable (sub-table header + thunk slot) - 4 bytes vtable (on_log in primary table) - ~23 bytes thunk code - ~39 bytes total per class Affected classes: APIServer, WebServer, MQTTClientComponent, Syslog, BLENUS, LoggerMessageTrigger (6 classes, ~234 bytes total). The non-capturing lambdas used at registration sites decay to plain function pointers at compile time -- zero closure/std::function overhead.