From 7ec61ae2658fe3a5e512cbebe8e5c2e17d900ab5 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 24 Feb 2026 11:15:52 -0600 Subject: [PATCH] [core] Prevent inlining of mark_matching_items_removed_locked_ The BK7231N Thumb-1 compiler inlines this function 3 times into cancel_item_locked_, bloating it from ~140 B to 666 B. ESP32 and RTL8720CF compilers already outline it, so this attribute only affects BK7231N. Saves ~486 B of flash. --- esphome/core/scheduler.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/esphome/core/scheduler.h b/esphome/core/scheduler.h index 16b0ded312..ed457b87f6 100644 --- a/esphome/core/scheduler.h +++ b/esphome/core/scheduler.h @@ -496,9 +496,9 @@ class Scheduler { // name_type determines matching: STATIC_STRING uses static_name, others use hash_or_id // Returns the number of items marked for removal // IMPORTANT: Must be called with scheduler lock held - size_t mark_matching_items_removed_locked_(std::vector> &container, - Component *component, NameType name_type, const char *static_name, - uint32_t hash_or_id, SchedulerItem::Type type, bool match_retry) { + __attribute__((noinline)) size_t mark_matching_items_removed_locked_( + std::vector> &container, Component *component, NameType name_type, + const char *static_name, uint32_t hash_or_id, SchedulerItem::Type type, bool match_retry) { size_t count = 0; for (auto &item : container) { // Skip nullptr items (can happen in defer_queue_ when items are being processed)