Commit Graph
26478 Commits
Author SHA1 Message Date
J. Nick Koston 8f49aab070 Merge branch 'scheduler-cancel-fast-path' into integration 2026-04-02 12:23:15 -10:00
J. Nick Koston 0fb534bb28 [scheduler] Skip cancel for anonymous items, add empty-container fast path
Two optimizations to reduce overhead in the scheduler hot path:

1. Skip cancel_item_locked_ entirely for anonymous items (STATIC_STRING
   with nullptr name) in set_timer_common_. These can never match any
   existing item, so the scan is pure waste. This is the common path
   for Component::defer(func).

2. Split mark_matching_items_removed_locked_ into an inline wrapper
   that checks for empty containers and a noinline slow path. This
   avoids the function call overhead when containers are empty, which
   is the common case for defer_queue_ and to_add_ after draining.
2026-04-02 11:57:57 -10:00
J. Nick Koston 4535b82483 [scheduler] Remove redundant Defer_UniqueID, keep anonymous + same-ID
UniqueID benchmark was unrealistic — unique IDs still ran
cancel_item_locked_ scanning all containers for matches that never
exist. Replace with just two meaningful defer variants:
- Defer: anonymous (nullptr name, skips cancel entirely)
- Defer_SameID: fixed ID (cancel-and-replace coalescing pattern)
2026-04-02 11:51:52 -10:00
J. Nick Koston ed14694e46 [scheduler] Add defer benchmark variants and fix anonymous defer path
- Scheduler_Defer: use nullptr name matching Component::defer(func)
  production pattern (skips cancel_item_locked_ entirely)
- Scheduler_Defer_SameID: fixed ID 0 measuring cancel-and-replace
  pattern for coalescing rapid updates
- Scheduler_Defer_UniqueID: unique IDs measuring cancel scan overhead
  when no match is found
2026-04-02 11:45:03 -10:00
J. Nick Koston ce5c36a02a [scheduler] Fix pool imbalance in benchmarks, add static_assert
Change kInnerIterations from 2000 to 2100 (divisible by batch sizes 3
and 10) to prevent pool imbalance at iteration boundaries that caused
spurious malloc. Add static_assert to each benchmark to catch this at
compile time.
2026-04-02 11:38:18 -10:00
J. Nick Koston 904577bf91 [scheduler] Extract warm_pool helper for scheduler benchmarks
Replace duplicated pool warmup blocks with a shared warm_pool() helper
that registers and replaces items twice to populate the recycling pool
before the benchmark loop begins.
2026-04-02 11:31:27 -10:00
J. Nick Koston 279686b1c2 [scheduler] Add ExceedPool benchmark to measure pool overflow cliff
Add Scheduler_SetTimeout_ExceedPool with batch size 10 (exceeding
MAX_POOL_SIZE=5) to measure the performance impact when the recycling
pool is exhausted and items must be malloc'd/freed each cycle.
2026-04-02 11:26:28 -10:00
J. Nick Koston 615b2b339a [scheduler] Batch 3 registrations per call() for realistic worst case
Instead of draining after every single registration or batching 5,
use a batch size of 3 which represents a realistic worst case where
multiple components schedule in the same loop iteration while staying
within the recycling pool (MAX_POOL_SIZE=5).
2026-04-02 11:24:53 -10:00
J. Nick Koston 347f981768 [scheduler] Fix unrealistic scheduler benchmarks missing periodic drain
Scheduler registration benchmarks (SetTimeout, SetInterval, Defer) were
not calling scheduler.call() periodically to drain and clean up cancelled
items. In production, call() runs every loop iteration, keeping the
scheduler containers small. Without draining, cancelled items accumulated
causing O(n²) scan cost in cancel_item_locked_ that doesn't reflect
real-world behavior.

- SetTimeout: was only calling process_to_add() (no cleanup), now calls
  call() every kKeyCount iterations
- SetInterval: was calling process_to_add() (no cleanup of items_), now
  calls call() for proper cleanup
- Defer: was never draining the defer queue, now calls call() to process
  deferred items as production does
- All three now advance time (++now) to match production loop behavior
2026-04-02 11:18:17 -10:00
Jonathan Swoboda 4d0d3cc271 [sen5x] Remove dead voc_baseline config option (#15391) 2026-04-02 10:53:53 -10:00
Jonathan Swoboda 4134763f34 [at581x][canbus] Fix walrus operator skipping falsy config values (#15390) 2026-04-02 20:32:10 +00:00
1e72f0ee5a [nextion] Gate waveform code behind USE_NEXTION_WAVEFORM, use StaticRingBuffer (#15273)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick+github@koston.org>
Co-authored-by: J. Nick Koston <nick@koston.org>
2026-04-02 20:17:20 +00:00
J. Nick Koston 67238e3d74 Merge remote-tracking branch 'upstream/dev' into integration
# Conflicts:
#	tests/components/time/posix_tz_parser.cpp
2026-04-02 10:13:20 -10:00
J. Nick Koston 63710a4cb7 [spi] Add spi0 and spi1 to reserved IDs for RP2040 compatibility (#15388) 2026-04-02 16:10:16 -04:00
c82166e5f3 [dsmr] Allow setting MBUS id for thermal sensors in DSMR component (#7519)
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2026-04-02 10:06:49 -10:00
Jonathan Swoboda 90624e6eca [deep_sleep] Fix wakeup_pin_mode rejecting lowercase on ESP32/BK72XX (#15384) 2026-04-02 09:34:27 -10:00
Jonathan Swoboda 6b89998b60 [template] Fix cover position_action overridden by has_position default (#15379) 2026-04-02 09:29:33 -10:00
Jonathan Swoboda dde472b0cf [pipsolar] Fix set_level action passing string to cv.use_id (#15380) 2026-04-02 09:28:44 -10:00
dependabot[bot]andJ. Nick Koston f7222a0e6c Bump ruff from 0.15.8 to 0.15.9 (#15385)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2026-04-02 19:28:30 +00:00
Jonathan Swoboda 0262d20bbe [mlx90393] Remove call to non-existent set_drdy_pin method (#15381) 2026-04-02 09:26:47 -10:00
Jonathan Swoboda 37b33f62de [htu21d] Fix set_heater action reading wrong config key (#15378) 2026-04-02 09:25:54 -10:00
Jonathan Swoboda 2f405fd96f [espnow] Fix enable_on_boot config option not passed to C++ (#15377) 2026-04-02 09:25:15 -10:00
dependabot[bot] 67ee727e38 Bump docker/login-action from 4.0.0 to 4.1.0 in the docker-actions group (#15386)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-02 09:24:26 -10:00
Jonathan Swoboda 12a0f5959f [bl0940] Fix reference_voltage config ignored in non-legacy mode (#15375) 2026-04-02 09:23:04 -10:00
Jonathan Swoboda 5dcae1a133 [climate] Fix MQTT target_temperature_low_state_topic calling wrong setter (#15376) 2026-04-02 09:22:07 -10:00
Jonathan Swoboda 0343121e9b [ble_client] Fix descriptor_uuid ignored for text sensors (#15374) 2026-04-02 09:21:18 -10:00
J. Nick Koston da09e1e1ce [time] Use O(1) closed-form leap year math for epoch-to-year conversion (#15368) 2026-04-02 09:19:47 -10:00
Jonathan Swoboda e7e590b36f [thermostat] Fix on_boot_restore_from DEFAULT_PRESET validation bypass (#15383) 2026-04-02 19:08:43 +00:00
Kevin Ahrendt da8d9d9c2d [audio] use microFLAC library for decoding (#15372) 2026-04-02 11:37:14 -04:00
Kevin Ahrendt b8a9d327f0 [media_player] Add enqueue action (#14775) 2026-04-02 10:40:19 -04:00
a359ecaaf4 [zigbee] print logs after reporting info update (#13916)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2026-04-02 14:12:20 +00:00
J. Nick Koston c21c7dd292 [mitsubishi_cn105] Fix test grouping conflict with uart package (#15366) 2026-04-02 09:12:38 -04:00
Edward Firmo 34295fbd69 [nextion] Collapse nested namespace to esphome::nextion (#15367) 2026-04-02 00:25:54 -10:00
J. Nick Koston 93e9ccbf15 Merge remote-tracking branch 'origin/api/peel-first-write-iteration' into integration 2026-04-01 23:34:47 -10:00
J. Nick Koston 8ffdaacdcb [api] Add missing this-> prefix on member access in noise frame helper 2026-04-01 23:33:08 -10:00
J. Nick Koston e4ba7c77b7 Merge remote-tracking branch 'origin/api/peel-first-write-iteration' into integration 2026-04-01 23:29:54 -10:00
J. Nick Koston e20f5c2cf5 [api] Pass payload_size and message_type directly to encrypt_noise_message_
Avoids constructing a MessageInfo in write_protobuf_packet just to
pass two fields through.
2026-04-01 23:27:28 -10:00
J. Nick Koston 32241bee78 Merge remote-tracking branch 'origin/api/peel-first-write-iteration' into integration 2026-04-01 23:24:12 -10:00
J. Nick Koston 0d6602818c [api] Inline temp variables in write_protobuf_packet
msg_start and msg_len are single-use register temporaries — pass
the expressions directly to write_raw_fast_buf_.
2026-04-01 23:23:47 -10:00
J. Nick Koston d55f5b9b77 Merge remote-tracking branch 'origin/api/peel-first-write-iteration' into integration 2026-04-01 23:14:29 -10:00
J. Nick Koston adaab73761 [api] Pass payload_size and message_type directly to write_plaintext_header
Avoids constructing a MessageInfo in write_protobuf_packet just to
pass two fields through.
2026-04-01 23:13:33 -10:00
J. Nick Koston a1a1bee060 Merge remote-tracking branch 'origin/api/peel-first-write-iteration' into integration 2026-04-01 22:59:27 -10:00
J. Nick Koston 3f9d8ccf98 [api] Fix clang-tidy: rename varint helpers, remove unused function
Drop trailing underscore from static functions (readability-identifier-naming)
and remove unused plaintext_header_length.
2026-04-01 22:58:08 -10:00
J. Nick Koston 3ca5e9a3f5 [api] Extract inline varint encoders as named ALWAYS_INLINE helpers
Move the inline varint byte writes into encode_varint_16_ and
encode_varint_8_ for readability. Same generated code since both
are ALWAYS_INLINE.
2026-04-01 22:47:13 -10:00
J. Nick Koston a8c6c55de2 [api] Inline varint encoding in write_plaintext_header
Replace two out-of-line encode_varint_to_buffer calls with direct
byte writes using the already-computed varint lengths. Eliminates
function call overhead (register save/restore) from the batch loop
and removes the 34-byte out-of-line encode_varint_to_buffer function
which had no other callers.
2026-04-01 22:43:58 -10:00
J. Nick Koston 1f455e7737 adjust 2026-04-01 22:32:08 -10:00
J. Nick Koston 6576ebc294 [api] Update stale comments in write_protobuf_messages 2026-04-01 22:31:58 -10:00
J. Nick Koston ebefe76362 adjust 2026-04-01 22:30:48 -10:00
J. Nick Koston cdf1adaa39 [api] Eliminate nullptr branch from write_protobuf_messages loop
Pre-compute the first message's header length before the loop to
initialize write_start/write_end. The first loop iteration naturally
skips memmove since src == write_end.

Extract varint_encoded_length_16/8 and plaintext_header_length as
reusable inline helpers from write_plaintext_header.
2026-04-01 22:20:56 -10:00
J. Nick Koston 06bc9462f1 [api] Deduplicate header code in plaintext write_protobuf_messages
Use a single loop for all messages instead of separate first-message
and loop paths. The first iteration skips memmove via the null check.
Eliminates duplicated write_plaintext_header inlining, reducing flash
from 326 to 229 bytes (-30%) while keeping the 64-byte stack frame.
2026-04-01 22:10:17 -10:00