mirror of
https://github.com/esphome/esphome.git
synced 2026-09-17 01:58:39 +00:00
7ae1f2f6d7686c35e0ddaffba1d89bda6e3d06af
ClimateTraits contained two std::vector<const char *> members for custom fan modes and custom presets. Every get_traits() / traits() call reconstructed these vectors, causing heap allocations on every publish_state() and control()/perform() call — the hottest paths in the climate component. Move the vector storage to the Climate base class and have ClimateTraits hold const pointers instead. get_traits() wires the pointers automatically. This eliminates all heap allocation from ClimateTraits copies, making the struct trivially copyable (floats + bitmasks + 2 pointers). Additionally, set_custom_fan_mode_() and set_custom_preset_() no longer need to call get_traits() just to search for a mode — they search the Climate-owned vectors directly, removing another traits rebuild from the control/perform path.
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
596 MiB
Languages
C++
55.8%
Python
43.6%
C
0.3%
JavaScript
0.2%
