mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 14:01:01 +00:00
3cee06e930b52e6158dbca3163d10328614f272a
Voluptuous schema construction inside container_schema() and the register_action() chain in WidgetType.__init__ dominates cold-validate time for any YAML that imports the lvgl component. cProfile of a cold `import esphome.components.lvgl` shows ~225ms cumulative inside container_schema (9 callers) and ~196ms cumulative inside base_update_schema (30 callers, one per widget type), out of ~400ms total. Defer both: container_schema now returns a validator that builds its underlying schema on first call, and WidgetType registers a lazy validator with register_action so base_update_schema is only evaluated when an `lvgl.<widget>.update` action is actually validated. Measured on M-series Mac, fresh subprocess, 5 cold imports: Before: 389, 385, 389, 384, 380 ms (avg 385ms) After: 229, 217, 218, 215, 215 ms (avg 219ms) A 43% reduction in `import esphome.components.lvgl`. Real `esphome -q config` on tests/components/lvgl/test.host.yaml drops from ~770ms to ~550ms (warm-cache subprocess). Extrapolated to slower hardware (Celeron N5105 dashboard hosts) this is ~1.5s saved per cold LVGL save. Schema output is unchanged: lvgl test configs validate identically and `script/build_language_schema.py` produces a byte-identical lvgl sub-tree before vs after.
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
393 MiB
Languages
C++
60.7%
Python
38.9%
C
0.3%
