Repository navigation
refactor(channels): extract showPixels cold-path errors + gate addDriver capStr build (#2773 iter 3) - #2832
refactor(channels): extract showPixels cold-path errors + gate addDriver capStr build (#2773 iter 3)#2832zackees wants to merge 1 commit into
Conversation
…ver capStr build (#2773 iter 3) Two more applications of the noinline-helper pattern from iter 2 (PR #2826), chasing the next two FastLED-owned hot symbols in the esp32dev Blink build: ## Channel::showPixels — was 4243 B (#2 in the symbol table) Three multi-line `FL_ERROR(... << ...)` chains in showPixels, each behind a one-shot guard (`mBusWarned`, `mDisabledDriverWarned`), inlined ~10 `operator<<` instantiations into the hot path that runs every frame: - typed-Bus-not-instantiated diagnostic (#2455 / #2459) - typed-Bus-chipset-mismatch diagnostic - disabled-driver silent-drop diagnostic (#2517) Moved into three `noinline static` helpers in the existing anonymous namespace just above showPixels: - `emitTypedBusNotInstantiatedError(name, busKey)` - `emitTypedBusChipsetMismatchError(name, busKey)` - `emitDisabledDriverError(name, driverName, exclusive)` Pure code motion — same rodata, same FL_ERROR severity, same one-shot guard semantics. Each guard still fires exactly once per channel lifetime; the helper call is on the cold path. ## ChannelManager::addDriver — was 2367 B (#5 in the symbol table) The capability-string builder (`capStr`) at the bottom of addDriver existed *only* to populate the trailing FL_DBG line. On release builds (`FASTLED_HAS_DBG == 0`) FL_DBG is no-op, but the `fl::string` allocation and the two branch-checks (`supportsClockless` / `supportsSpi`) still ran and still emitted code. Wrap the entire block (capStr build + FL_DBG) in `#if FASTLED_HAS_DBG`. On default ESP32 builds (SKETCH_HAS_LARGE_MEMORY → FASTLED_HAS_DBG=1) this is a no-op; on `-DFASTLED_LOG_VERBOSITY=0` and `-DFASTLED_DISABLE_DBG=1` builds it removes the dead code entirely. ## Verification Local fbuild esp32dev build infrastructure (zccache daemon) is broken on my workstation today, so size measurements rely on CI. Pattern is the same one that landed in iter 2 (PR #2826: createChannel -28%). Iter 2 is already merged on master with no regressions; this PR extends the same mechanical refactor to two adjacent symbols. Refs #2773 (memory-hunt loop, iter 3). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Too much diff to scan? Review this PR in Change Stack to start with the highest-impact changes. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR refactors diagnostic error emissions in ChangesPerformance and size optimization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Closing — most of this work was shipped in parallel via #2830 (showPixels cold-path split + FL_NO_INLINE migration). The two pieces this PR has that #2830 didn't ( |
… into FL_NO_INLINE helper (#2773 follow-up to #2832) The two-branch `FL_ERROR(... << ...)` chain in `Channel::showPixels` that fires when a bound driver has been runtime-disabled (typically by `FastLED.setExclusiveDriver<OtherBus>()`) was still inlined into the hot path. The branch is one-shot (`mDisabledDriverWarned`) and unreachable in the steady state, so the ~10 `operator<<` instantiations were pure cold-path bloat sitting in showPixels' prologue/epilogue. Move into an anonymous-namespace helper marked `FL_NO_INLINE` (per the `bare_noinline_checker` introduced in #2830, not bare `__attribute__((noinline))`), matching the shape the maintainer adopted for `resolveDynamicDriver()` in PR #2830. This is the leftover piece from PR #2832, which the maintainer flagged in the closing comment as worth a follow-up: > The two pieces this PR has that #2830 didn't (emitDisabledDriverError > and the #if FASTLED_HAS_DBG gate on ChannelManager::addDriver's > capStr builder) are small enough (~couple hundred bytes) that a > rebase round trip isn't worth the churn vs just reopening them in > a follow-up. The `addDriver` capStr DBG gate piece of #2832 was independently shipped by the maintainer as iter 6 (commit `ea96b373b5`, `perf(channels): gate addDriver capStr builder behind FASTLED_HAS_DBG (#2773 iter 6)`), so this rebase drops that half and keeps only the unique `emitDisabledDriverError` extraction. Refs #2773. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Summary
Two more applications of the noinline-helper pattern from iter 2 (PR #2826), targeting the next two FastLED-owned hot symbols on the esp32dev Blink build.
Channel::showPixels (4243 B → expected ~3000 B)
Three multi-line
FL_ERROR(... << ...)chains in showPixels, each behind a one-shot guard (mBusWarned,mDisabledDriverWarned), were inlining ~10 `operator<<` instantiations into the path that runs every frame:Moved into three
noinline statichelpers in the existing anonymous namespace just above showPixels:Pure code motion — same rodata, same FL_ERROR severity, same one-shot guard semantics.
ChannelManager::addDriver (2367 B)
The capability-string builder (`capStr`) at the bottom of addDriver existed only to populate the trailing FL_DBG line. On release builds (`FASTLED_HAS_DBG == 0`) FL_DBG is no-op, but the `fl::string` allocation and the two branch-checks still ran and still emitted code. Wrap the whole block in `#if FASTLED_HAS_DBG`.
Verification status
My local fbuild esp32dev infrastructure is currently broken (zccache daemon won't start — all native + ESP32 builds fail with `zccache[err]: cannot connect to daemon`), so size measurements rely on CI. The pattern is the same one that landed in iter 2 (PR #2826: createChannel −28%, already merged on master with no regressions); this PR extends the same mechanical refactor to two adjacent symbols.
Test plan
Refs #2773 (memory-hunt loop, iter 3).
🤖 Generated with Claude Code
Summary by CodeRabbit