Repository navigation
Description
Goal
Gate the "silent-drop" diagnostic in `fl::Channel::showPixels` on `FASTLED_LOG_RUNTIME_ENABLED` so the helper, the `exclusiveDriverName()` call, and the supporting string temporaries dead-strip from release builds.
Parent: #2886 — tactical bloat win, same dead-strip-cascade pattern as #2918 / #2925 / #2943.
Why this is a real win
`src/fl/channels/channel.cpp.hpp:634-650` runs every frame:
```cpp
fl::string driverName = driver->getName();
auto status = ChannelManager::instance().driverStatus(driverName);
if (status == ChannelManager::DriverStatus::STATUS_DISABLED) {
if (!mDisabledDriverWarned) {
emitDisabledDriverError(
mName, driverName,
ChannelManager::instance().exclusiveDriverName());
mDisabledDriverWarned = true;
}
return;
} else if (status == ChannelManager::DriverStatus::STATUS_ENABLED) {
mDisabledDriverWarned = false;
}
```
`emitDisabledDriverError` (`channel.cpp.hpp:130-146`) is a `FL_NO_INLINE` cold helper whose entire body is two `FL_ERROR(...)` sites — a 5-line `fl::sstream` chain and a 4-line one. In release builds (NDEBUG → `FASTLED_LOG_VERBOSITY=0` per #2890) both `FL_ERROR` calls collapse to `do { } while(0)`, leaving an empty function — but the linker can't dead-strip it because the call site at `channel.cpp.hpp:638` is still live.
The call-site overhead in release builds today:
- The empty `emitDisabledDriverError` body (a 3-string-arg function, returned by ABI).
- The `ChannelManager::instance().exclusiveDriverName()` call — only reachable from this site, so dead-strip cascades into the `exclusiveDriverName` getter + the string return + the `mExclusiveDriverName` field reads.
- A 3-argument `fl::string` pass-by-const-ref chain.
- The `mDisabledDriverWarned` reads/writes (single bool but still emits SDB code).
Deliverable
`src/fl/channels/channel.cpp.hpp` — gate the diagnostic call site
```cpp
if (status == ChannelManager::DriverStatus::STATUS_DISABLED) {
#if FASTLED_LOG_RUNTIME_ENABLED
if (!mDisabledDriverWarned) {
emitDisabledDriverError(
mName, driverName,
ChannelManager::instance().exclusiveDriverName());
mDisabledDriverWarned = true;
}
#endif
return;
} else if (status == ChannelManager::DriverStatus::STATUS_ENABLED) {
#if FASTLED_LOG_RUNTIME_ENABLED
mDisabledDriverWarned = false;
#endif
}
```
The `return` on STATUS_DISABLED is preserved unconditionally — release builds still skip the enqueue for disabled drivers (matches current behaviour). Only the diagnostic emission and the one-shot latch maintenance get gated.
Behavior matrix
| Build | status | Behaviour |
|---|---|---|
| Debug (`FASTLED_LOG_VERBOSITY=1`) | DISABLED | One-shot `FL_ERROR` emitted; frame dropped. |
| Debug | ENABLED | Latch reset; frame enqueued normally. |
| Release (`FASTLED_LOG_VERBOSITY=0`) | DISABLED | Frame dropped silently — user accepts the loss when they disable diagnostics. |
| Release | ENABLED | Frame enqueued normally. |
Existing public API unchanged. `driverStatus` check remains live in both builds because the STATUS_DISABLED → `return` matters for correctness.
Acceptance
- `bash lint --cpp` passes.
- Behaviour preserved in debug builds.
- `bloat regression esp32s3` on the PR passes (any positive saving lowers `tests/data/esp32s3_bloat_baseline.txt` in a follow-up ratchet).
Expected savings
Projected ~300-800 B. The dead-strip cascade pattern from #2918 (−2,235 B vs projected 800), #2925 (−3,937 B vs projected 1-2 KB), #2943 (−1,845 B vs projected 100-300 B) suggests this may exceed projection if `exclusiveDriverName()` was reachable only from this site.
Out of scope
- Removing `mDisabledDriverWarned` entirely from the class. Cost is 1 byte (fits in existing padding) and keeping the field makes the conditional code symmetrical between debug/release.
- Gating the `fl::string driverName = driver->getName()` call at line 634 — `driverName` is also used by `driverStatus()` immediately below and (debug-only) by the FL_ERROR call.
Related
- Meta: ESP32-S3 Blink bloat reduction (file:line concrete plan) — supersedes #2885 #2886 — parent meta + audit cycle.
- perf(log): default FASTLED_LOG_VERBOSITY=0 in release builds (#2886 Stage 1) #2890 — Stage 1 (the `FASTLED_LOG_VERBOSITY=0` default this gate piggybacks on).
- perf(esp32): gate emit* cold helpers on FASTLED_LOG_RUNTIME_ENABLED (~800 B) #2918 / fix(esp32): correct FASTLED_ASSERT release no-op + ratchet baseline 344769 -> 340832 #2925 / perf(gamma): simplify Gamma8::getOrCreate to single-entry weak_ptr cache #2929 / perf(channel): skip auto-naming in release builds (#2942) #2943 — gating patterns for diagnostic-only paths.
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
perf(channel): gate emitDisabledDriverError diagnostic chain (#2950) (#…
perf(channel): gate bus-miss diagnostic probe in release builds (#2952)…
perf(rmt5): gate handleAllocateTxFailure diagnostic block (#2956) (#2957