Commit Graph
24233 Commits
Author SHA1 Message Date
J. Nick Koston 45ed033ee5 Merge remote-tracking branch 'upstream/proto-force-field-option' into integration 2026-03-07 16:46:32 -10:00
J. Nick KostonandClaude Opus 4.6 a27f5127d8 [api] Add force field option to skip zero checks on hot path
Add a `force` proto field option that generates `_force` variants of
calc_ and encode methods, skipping the zero/empty check. Applied to
BluetoothLERawAdvertisement fields that are almost always non-default
(address, rssi, data) to eliminate dead branches on the BLE proxy
hot path.

On-device benchmarks show calculate_size improved from 12,649 ns to
10,982 ns per 12-advertisement batch (-13.2%) with only +8 bytes flash.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 16:44:12 -10:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ea7cfffdda Bump aioesphomeapi from 44.3.1 to 44.4.0 (#14609)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-08 02:40:13 +00:00
J. Nick KostonandClaude Opus 4.6 71bc54eb81 Merge upstream/inline-varint-fast-path into integration
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 15:42:58 -10:00
J. Nick KostonandClaude Opus 4.6 8ae54656fc Move varint_slow to private
It has a precondition (value >= 128) and should not be callable
from outside the class.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 15:41:45 -10:00
J. Nick KostonandClaude Opus 4.6 a5780eec54 Extract varint_wide helper to deduplicate cascade
The constexpr path and the noinline slow path shared the same
if/else cascade for values >= 128. Extract into a private
constexpr ESPHOME_ALWAYS_INLINE helper used by both.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 15:41:01 -10:00
J. Nick KostonandClaude Opus 4.6 44b50055af Rename varint_slow_ to varint_slow for clang-tidy naming
Static methods use lower_snake_case without trailing underscore.
The trailing underscore convention is for member fields only.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 15:31:33 -10:00
J. Nick KostonandClaude Opus 4.6 ddeb8038c4 Merge origin/inline-varint-fast-path into integration branch
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 15:29:52 -10:00
J. Nick KostonandClaude Opus 4.6 244e672b0a Revert force-inlining of calc_uint32 and calc_length
The ESPHOME_ALWAYS_INLINE on these caused significant flash bloat in
cold calculate_size() callers (DeviceInfoResponse +117B, HelloResponse
+63B, ListEntitiesEventResponse +79B) while only benefiting the BLE
hot path marginally. Let the compiler decide when to inline these.

The varint() fast path remains force-inlined as that eliminates the
most expensive indirect calls on the hot path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 15:28:06 -10:00
J. Nick Koston 05896c38e8 [api] Inline ProtoSize::varint fast path for hot loop performance
Split ProtoSize::varint() into an always-inlined fast path (value < 128)
and a noinline slow path, eliminating indirect function calls on the BLE
advertisement encode hot path. Also force-inline calc_uint32() and
calc_length() so the compiler fully inlines size calculations per
advertisement instead of emitting out-of-line calls.

Verified via Xtensa disassembly: eliminates ~80 indirect function calls
per 16-advertisement batch flush (3 calc + varint per advertisement).
Total hot path code reduced from 24 to 21 functions.
2026-03-07 15:20:58 -10:00
J. Nick Koston ce3fcca292 Merge branch 'integration' of https://github.com/esphome/esphome into integration 2026-03-07 14:51:36 -10:00
J. Nick Koston da8de59bcb Merge remote-tracking branch 'upstream/proto-byte-buffer' into integration 2026-03-07 13:38:26 -10:00
J. Nick Koston 2a1af73d6f Merge branch 'dev' into proto-byte-buffer 2026-03-07 13:34:15 -10:00
J. Nick Koston e3c9f851a4 Merge remote-tracking branch 'upstream/proto-byte-buffer' into integration 2026-03-07 13:33:01 -10:00
J. Nick Koston 51cff74f03 [api] Outline ProtoByteBuffer reallocation into grow_()
The capacity check in reserve()/resize() is the hot path and stays
inline via ESPHOME_ALWAYS_INLINE. The actual reallocation (make_buffer
+ memcpy) is a cold path outlined into grow_() to avoid bloating
every call site. resize() delegates to reserve() for the capacity
check since both inline to the same code.
2026-03-07 13:32:23 -10:00
J. Nick Koston 06525e14d7 Merge remote-tracking branch 'upstream/proto-byte-buffer' into integration 2026-03-07 13:29:13 -10:00
J. Nick KostonandClaude Opus 4.6 9e082edecb [api] Outline ProtoByteBuffer reallocation into grow_()
The capacity check in reserve()/resize() is the hot path and stays
inline. The actual reallocation (make_buffer + memcpy) is a cold path
that should be outlined to avoid bloating every call site.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 13:28:04 -10:00
J. Nick Koston 888f3d804b [ld2420] Add integration tests with mock UART (#14471) 2026-03-07 13:22:50 -10:00
J. Nick Koston 545395a6f0 [ci] Add RP2350 to PR template test environment (#14599) 2026-03-07 13:16:19 -10:00
Oliver Kleinecke f2dfb5e1dc [uart][usb_uart] Add debug_prefix option to distinguish multiple defined uarts in log (#14525) 2026-03-08 10:16:12 +11:00
J. Nick Koston a79c616879 Merge branch 'integration' of https://github.com/esphome/esphome into integration 2026-03-07 12:46:07 -10:00
J. Nick Koston 76dd72e162 Merge branch 'proto-byte-buffer' into integration 2026-03-07 09:04:28 -10:00
J. Nick Koston d3c5d91469 [api] Expand ProtoByteBuffer comment to explain why skipping zero-fill is safe 2026-03-07 09:03:55 -10:00
Diorcet YannandJonathan Swoboda 3f700bac1c [component] Fix components for compatibility with stricter compilers (#14545)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2026-03-07 18:50:44 +00:00
J. Nick Koston 7d52948529 [api] Fix comment to include LN882x in fallback list 2026-03-07 08:50:06 -10:00
J. Nick Koston 46b730e412 [api] Fix comment to include LN882x in fallback list 2026-03-07 08:50:01 -10:00
J. Nick Koston 159c62fff5 Merge remote-tracking branch 'upstream/proto-byte-buffer' into integration 2026-03-07 08:43:30 -10:00
J. Nick Koston 4ce1c3ffd9 [api] Also fall back to make_unique on LN882x; add LN882x test config 2026-03-07 08:42:32 -10:00
J. Nick Koston 0867866317 [api] Also fall back to make_unique on LN882x; add LN882x test config 2026-03-07 08:42:22 -10:00
J. Nick Koston 67ad9bf4e2 Merge branch 'proto-byte-buffer' into integration 2026-03-07 08:39:36 -10:00
J. Nick Koston 961d55883c [api] Fall back to make_unique on BK72xx (older GCC lacks make_unique_for_overwrite) 2026-03-07 08:39:01 -10:00
J. Nick Koston b8fedf6e5b [api] Fall back to make_unique on BK72xx (older GCC lacks make_unique_for_overwrite) 2026-03-07 08:38:52 -10:00
J. Nick Koston a4a7bbb149 Merge branch 'proto-byte-buffer' into integration 2026-03-07 08:22:54 -10:00
J. Nick Koston 25a68e9339 [api] Inline capacity check in ProtoByteBuffer::resize()
Avoid calling reserve() when capacity is already sufficient.
After warmup, resize() becomes just a compare + store with no
function call overhead on the hot path.
2026-03-07 08:22:09 -10:00
J. Nick Koston 85e818dda7 [api] Replace std::vector<uint8_t> with ProtoByteBuffer for shared write buffer
The API protobuf write path uses a shared buffer that gets resize()'d on
every message send. std::vector::resize() zero-fills new bytes, but every
byte is overwritten by the encoder before being read. For a 16-advertisement
BLE proxy batch, this wastes ~1300 bytes of memset per flush (~10x/second).

ProtoByteBuffer is a minimal replacement that skips zero-initialization on
resize(). On ESP32/RP2040/LibreTiny it also skips zero-fill on allocation
via make_unique_for_overwrite. On ESP8266 it falls back to make_unique
(zero-fills on alloc, but resize still doesn't zero-fill — the main win
is preserved since reserve is typically a no-op after warmup).
2026-03-07 08:17:37 -10:00
J. Nick Koston 0fd58c6ce0 Merge remote-tracking branch 'upstream/staticvector-skip-zero-init' into integration 2026-03-07 08:02:38 -10:00
J. Nick Koston b8b219926d [core] Skip zero-initialization of StaticVector data array
Remove value-initialization ({}) from StaticVector's underlying
std::array. Only elements [0, count_) are ever accessed, so
initializing the full array is wasted work.

This eliminates a memset on every construction. Most impactful for
stack-allocated StaticVectors in hot paths like
APIPlaintextFrameHelper::write_protobuf_messages, which was
memsetting 276 bytes of iovec storage on every BLE proxy flush.
2026-03-07 08:01:08 -10:00
J. Nick Koston ed8e90bcb6 Merge remote-tracking branch 'upstream/inline-ble-addr-to-uint64' into integration 2026-03-07 07:57:35 -10:00
J. Nick Koston 9c56c95cf8 [esp32_ble] Inline ble_addr_to_uint64 to eliminate call overhead
Move ble_addr_to_uint64 from ble.cpp to ble.h as inline. This
eliminates the indirect call and Xtensa register window rotation
at all 3 call sites, most importantly in the BLE proxy hot path
(BluetoothProxy::parse_devices) which calls it per advertisement.

Saves 24 bytes of flash overall.
2026-03-07 07:56:34 -10:00
J. Nick Koston f05b1ab036 Merge branch 'protect_entity_setters' into integration
# Conflicts:
#	esphome/components/bluetooth_proxy/bluetooth_proxy.cpp
2026-03-07 07:44:47 -10:00
J. Nick Koston 70a01158d3 Merge remote-tracking branch 'upstream/dev' into protect_entity_setters
# Conflicts:
#	esphome/core/entity_base.cpp
#	esphome/core/entity_base.h
#	esphome/core/entity_helpers.py
#	tests/component_tests/sensor/test_sensor.py
#	tests/component_tests/text_sensor/test_text_sensor.py
2026-03-07 07:30:27 -10:00
J. Nick Koston a0cd35c5fc [core] Inline status_clear_warning/error fast path (#14571) 2026-03-07 07:27:08 -10:00
J. Nick Koston e7b8ec18f1 [api] Inline APIServer::is_connected() for common no-arg path (#14574) 2026-03-07 07:26:50 -10:00
J. Nick Koston 77f2c371b2 [api] Single-pass protobuf encode for BLE proxy advertisements (#14575) 2026-03-07 07:26:34 -10:00
J. Nick KostonandClaude Opus 4.6 45f20d9c06 [core] Merge set_name + set_entity_strings into configure_entity_ (#14444)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 07:26:01 -10:00
J. Nick Koston f57fa4cc8d [bluetooth_proxy] Add BLE connection parameters API (#14577) 2026-03-07 07:25:33 -10:00
J. Nick Koston abc870006c [captive_portal] Enable support for RP2040 (#14505) 2026-03-07 07:25:13 -10:00
puddly 15ffbb0b05 [uart] Fully enable raw mode with host serial (#14573) 2026-03-07 11:51:02 -05:00
Simon Redman 8b62c35ea7 [uart] Add error message when initializing UART with unsupported configuration (#13229) 2026-03-07 11:41:37 -05:00
tomaszduda23 0e106d843c [nrf52][zephyr] support for multi on rate callbacks (#14557) 2026-03-07 11:18:21 -05:00