J. Nick Koston 3cee06e930 [lvgl] Build container_schema and widget update schemas lazily
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.
2026-05-16 15:03:33 -07:00
2023-06-12 17:00:34 +12:00
2022-09-06 15:48:01 +12:00
2024-03-28 10:20:51 +13:00
2025-12-08 14:37:45 -05:00
2026-05-14 12:33:43 +12:00
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%