Commit Graph
26117 Commits
Author SHA1 Message Date
J. Nick Koston e87239c7c3 Revert "revert peel"
This reverts commit 0606bf9c12.
2026-03-29 08:15:19 -10:00
J. Nick Koston b869701ee3 Revert "try revert float"
This reverts commit 868b2eb2ea.
2026-03-29 08:15:06 -10:00
J. Nick Koston 4d9bbf3b51 Merge branch 'api-sint32-short-varint' into integration 2026-03-28 23:18:57 -10:00
J. Nick Koston 868b2eb2ea try revert float 2026-03-28 23:12:08 -10:00
J. Nick Koston 0606bf9c12 revert peel 2026-03-28 23:01:33 -10:00
J. Nick Koston 35491f2649 Revert "[api] Merge tag + value into single __restrict__ scope in encode_uint32/uint64/bool/fixed32"
This reverts commit fe012272f8.
2026-03-28 22:15:28 -10:00
J. Nick Koston fe012272f8 [api] Merge tag + value into single __restrict__ scope in encode_uint32/uint64/bool/fixed32
Each of these methods called encode_field_raw() then a value encoder,
causing a store-load pair on pos_ between the tag and value writes.

Inline the tag write into the same __restrict__ local scope as the
value write so the compiler can emit tag + value with a single pos_
load at start and store at end. Verified on Xtensa: encode_uint32
now does one load + two writes + one store (was load-store-load-store).
2026-03-28 22:06:31 -10:00
J. Nick Koston 3e89858e39 Merge remote-tracking branch 'origin/api-sint32-short-varint' into integration 2026-03-28 21:43:28 -10:00
J. Nick Koston 0603190c3c [api] Restore debug bounds checks in __restrict__ varint loops
Add sync_debug_check_bounds_() that syncs pos_ from a local pointer
before checking bounds. Use it in encode_varint_raw_64 and
encode_varint_raw_slow_ to restore per-byte bounds checking in
debug mode without breaking the __restrict__ optimization in
production (where it's a no-op).
2026-03-28 19:55:50 -10:00
J. Nick Koston 3a76f9d5d2 [api] Merge varint length + memcpy into single pos scope in encode_string
Previously encode_string called encode_varint_raw(len) then
encode_raw(data, len) as separate methods, each with their own
__restrict__ pos scope. This caused a redundant store-load pair
of pos_ between the two operations.

Inline the length varint write and memcpy under a single local
pos variable so the compiler can keep pos_ in a register across
both operations. Eliminates one load-store pair per string encode.
2026-03-28 19:51:55 -10:00
J. Nick Koston c6938adb61 [api] Apply __restrict__ local hoist to all ProtoWriteBuffer pos_ accessors
Apply the same __restrict__ local pointer pattern proven in
encode_varint_raw_64 to all remaining methods that write through
pos_: encode_varint_raw, encode_varint_raw_short, write_raw_byte,
encode_raw, write_tag_and_fixed32, encode_string, encode_bool,
and encode_fixed32.

Each method now hoists pos_ into a __restrict__ local before
writing and stores back once at the end. When the compiler inlines
these into a generated encode() method, it can keep pos_ in a
register across consecutive calls instead of reloading from memory
after every write.
2026-03-28 19:47:40 -10:00
J. Nick Koston 83e4478bc2 [api] Apply __restrict__ local hoist to encode_varint_raw_slow_
Same optimization as encode_varint_raw_64: hoist pos_ into a
__restrict__ local so the compiler keeps it in a register across
the loop instead of reloading from memory each iteration.
2026-03-28 19:45:49 -10:00
J. Nick Koston 3886751662 [api] Restore comment on __restrict__ local in encode_varint_raw_64 2026-03-28 19:45:07 -10:00
J. Nick Koston 537af1fe6b [api] Hoist pos_ to local in encode_varint_raw_64 to avoid reload per byte
Use a __restrict__ local pointer for the varint write loop so the
compiler can keep it in a register instead of reloading pos_ from
memory on each iteration. Eliminates the store→load dependency
chain that was causing 7 load/store pairs for a typical 48-bit
BLE address varint.
2026-03-28 19:44:16 -10:00
J. Nick Koston 2137e4600a [api] Hoist pos_ to local in encode_varint_raw_64 to avoid reload per byte
Use a __restrict__ local pointer for the varint write loop so the
compiler can keep it in a register instead of reloading pos_ from
memory on each iteration. Eliminates the store→load dependency
chain that was causing 7 load/store pairs for a typical 48-bit
BLE address varint.
2026-03-28 17:43:11 -10:00
J. Nick Koston 52897fd067 [api] Add 2-byte inline fast path for sint32 varint encode/size
Add encode_varint_raw_short() and ProtoSize::varint_short() that
inline both the 1-byte and 2-byte varint paths, falling back to
the noinline slow path for 3+ bytes.

Use these for sint32 fields (zigzag encoding), where values like
RSSI (-100 to 0) produce zigzag values that are 1-2 bytes. This
avoids a function call for the common case without bloating the
generic encode_varint_raw fast path.
2026-03-28 17:27:40 -10:00
J. Nick Koston 777e162070 [benchmark] Add BLE raw advertisement proto encode benchmarks
Add CodSpeed benchmarks for BluetoothLERawAdvertisementsResponse
(12 advertisements) covering calculate_size, encode, calc+encode,
and fresh-buffer paths.

Includes a lightweight bluetooth_proxy stub header in
tests/benchmarks/stubs/ so the api component can compile with
USE_BLUETOOTH_PROXY on the host platform without pulling in
ESP32 BLE dependencies.
2026-03-28 17:08:52 -10:00
J. Nick Koston 2c0b9c431a Merge branch 'dedupe-build-time-str' into integration 2026-03-28 16:08:36 -10:00
J. Nick Koston 9b6d22be5f [version] Use App.get_build_time_string() instead of including build_info_data.h
Remove direct include of build_info_data.h from version_text_sensor.cpp
and use the existing App.get_build_time_string() API instead. This
eliminates duplicate ESPHOME_BUILD_TIME_STR and ESPHOME_COMMENT_STR
symbols that were emitted into every translation unit including the
header (static const in a header = one copy per TU).

Now only application.cpp includes build_info_data.h, which also
improves incremental rebuild times: when build info changes, only
application.cpp needs recompiling instead of both application.cpp
and version_text_sensor.cpp.
2026-03-28 16:05:36 -10:00
J. Nick Koston 90c7ad322b Merge remote-tracking branch 'upstream/dev' into integration 2026-03-28 15:50:13 -10:00
J. Nick Koston 7a7c33fdb1 [esp32_ble_server] Fix set_value action with static data lists (#15285) 2026-03-28 15:38:06 -10:00
J. Nick Koston ccc05bfd08 Merge remote-tracking branch 'upstream/fix-bl0942-energy-counter-reset' into integration 2026-03-28 14:12:32 -10:00
J. Nick Koston 35eda1293c Merge remote-tracking branch 'upstream/esp8266-enable-scanf-float' into integration 2026-03-28 14:12:22 -10:00
J. Nick Koston 638bbf8b4d [bl0942] Fix energy counter jump on chip reset 2026-03-28 13:25:28 -10:00
J. Nick Koston 3f24a65e6a [esp8266] Add enable_scanf_float option 2026-03-28 12:58:36 -10:00
J. Nick Koston 17716f074c Merge remote-tracking branch 'upstream/actionlist-drop-end-pointer' into integration 2026-03-28 10:57:26 -10:00
J. Nick Koston ff6db629f7 Rename actions_begin_ to actions_ since there is no longer an actions_end_ 2026-03-28 10:56:27 -10:00
J. Nick Koston 48e1618be9 Merge branch 'actionlist-drop-end-pointer' into integration 2026-03-28 10:55:11 -10:00
J. Nick Koston 78d1ce4222 Use pointer-to-pointer idiom in add_action() for consistency and smaller code 2026-03-28 10:54:53 -10:00
J. Nick Koston f6cfb6832d Use pointer-to-pointer idiom in add_action() for consistency and smaller code 2026-03-28 10:54:48 -10:00
J. Nick Koston 1d713613c3 Merge remote-tracking branch 'upstream/actionlist-drop-end-pointer' into integration 2026-03-28 10:49:19 -10:00
J. Nick Koston b209fe7ebe Add comment explaining why add_action uses if/else instead of pointer-to-pointer 2026-03-28 10:46:36 -10:00
J. Nick Koston e3e5f40a96 Revert "Use pointer-to-pointer idiom in add_action() for consistency"
This reverts commit db42403494.
2026-03-28 10:46:04 -10:00
J. Nick Koston b820a6fa19 Merge remote-tracking branch 'upstream/actionlist-drop-end-pointer' into integration 2026-03-28 10:41:08 -10:00
J. Nick Koston db42403494 Use pointer-to-pointer idiom in add_action() for consistency 2026-03-28 10:39:06 -10:00
J. Nick Koston 90f7924ecd Merge remote-tracking branch 'upstream/actionlist-drop-end-pointer' into integration 2026-03-28 10:35:23 -10:00
J. Nick Koston 0c313dbe66 Optimize add_actions() to find tail once instead of re-walking per action 2026-03-28 10:34:25 -10:00
J. Nick Koston f97f8d1cef Optimize add_actions() to find tail once instead of re-walking per action 2026-03-28 10:34:18 -10:00
J. Nick Koston adf01fedc6 Merge remote-tracking branch 'upstream/actionlist-drop-end-pointer' into integration 2026-03-28 10:30:30 -10:00
J. Nick Koston 79d2d8e5c8 [automation] Remove actions_end_ pointer from ActionList
Save 4 bytes per ActionList instance by removing the tail pointer
used only during setup() for O(1) append. Instead, walk the short
chain (typically 1-5 actions) to find the tail.

This saves 4 bytes per Automation on 32-bit platforms, which adds
up on memory-constrained devices like ESP8266 with many automations.
2026-03-28 10:28:40 -10:00
J. Nick Koston f0d618a842 Merge branch 'automation_conditions_static_array' into integration 2026-03-28 09:17:02 -10:00
J. Nick Koston 669b90258c [automation] Use std::array in And/Or/Xor conditions
Template AndCondition, OrCondition, and XorCondition on N so the
condition pointer list is stored in std::array<Condition<Ts...>*, N>
instead of FixedVector. N is set by code generation to match the
exact number of conditions configured in YAML.

Add init_array_from() helper for optimal codegen when initializing
std::array from initializer_list.
2026-03-28 09:09:53 -10:00
J. Nick Koston 0c92082f1d Merge sensor_value_list_static_array into integration 2026-03-28 08:46:22 -10:00
J. Nick Koston e2cb0edb10 Preserve ThrottleFilter position in .cpp for cleaner diff 2026-03-28 08:43:35 -10:00
J. Nick Koston f2663928c7 Move ThrottleWithPriorityFilter::new_value to non-template helper preserving exact dev behavior 2026-03-28 08:41:13 -10:00
J. Nick Koston 8fc08ad52d Consolidate throttle helpers into single throttle_check_with_priority function 2026-03-28 08:40:07 -10:00
J. Nick Koston 369a5c5043 Fix: prioritized values must update last_input_ to match dev behavior 2026-03-28 08:39:23 -10:00
J. Nick Koston c722ef0369 [sensor] Use std::array in ValueList/FilterOut/ThrottleWithPriority filters
Template ValueListFilter, FilterOutValueFilter, and ThrottleWithPriorityFilter
on N (the number of configured values) so the value list is stored in
std::array<TemplatableValue<float>, N> instead of FixedVector.

Non-template helpers value_list_matches_any() and throttle_check_and_update()
keep the iteration loops in the .cpp to avoid template bloat.
2026-03-28 08:37:04 -10:00
J. Nick Koston 28af6d2ecb Merge remote-tracking branch 'upstream/sensor_value_list_static_array' into integration 2026-03-28 08:30:23 -10:00
J. Nick Koston db15bb2494 Merge remote-tracking branch 'upstream/callback-manager-no-vector' into integration 2026-03-28 08:27:47 -10:00