mirror of
https://github.com/esphome/esphome.git
synced 2026-09-02 02:56:01 +00:00
0651a905bcb25e0dcc2926899b4bdac747b61229
The classic std::vector swap-with-copy idiom (vector<T>(other).swap(other)) instantiates the iterator-range copy constructor, which pulls in std::__throw_bad_array_new_length and the related typeinfo + vtable + dtor + what() method (~118 B of stdlib RTTI). Build into a temp via reserve + push_back instead, then move-assign: - reserve uses ::operator new (throws bad_alloc, already linked). - push_back without growth is the noexcept tail path. - move-assign just swaps pointers, no allocation. Same shrink semantics, saves ~128 B flash on ESP32. Also adds a fast-path early return for the case where capacity already equals size (common after a quiet period, since vector capacity only grows when crossing the doubling threshold).
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
585 MiB
Languages
C++
56.1%
Python
43.3%
C
0.3%
JavaScript
0.2%
