Repository navigation
refactor(rmt5): extract createChannel recovery sstream into noinline helpers (#2773 item 2.2 partial, −1820B) - #2826
Conversation
…helpers (#2773 item 2.2 partial, −1820B on ESP32) `fl::ChannelEngineRMTImpl::createChannel` was 6351 B on the esp32dev Blink build — the largest FastLED-owned symbol in the binary (see #2773 batch-2 audit). Two of the cold paths inside createChannel each built a ~15-line `fl::sstream` with multi-integer interpolation: the recovery warning (when progressive memory reduction succeeds) and the allocation failure error (when even minimum-block retry fails). Every `operator<<` instantiation in both was being textually inlined into createChannel, multiplying the operator-chain code on a path that is taken only when the RMT peripheral is contended at boot. Move both into `__attribute__((noinline))` member helpers: - `emitRecoveryWarning(original_symbols, reduced_symbols, external_words)` - `emitAllocationFailureError(retry_count, original_symbols, min_symbols, pin)` This is pure code motion — the rodata strings, the integer arguments the user sees, the FL_WARN / FL_ERROR severity, and the on-the-wire behaviour are all preserved. ## Size measurements (fbuild esp32dev release Blink) Before: ``` 000018cf W fl::ChannelEngineRMTImpl::createChannel(...) 6351 B ``` After: ``` 000011b3 W fl::ChannelEngineRMTImpl::createChannel(...) 4531 B (-1820 B, -28%) 000002f0 W fl::ChannelEngineRMTImpl::emitRecoveryWarning(...) 752 B (new) 0000031e W fl::ChannelEngineRMTImpl::emitAllocationFailureError(...) 798 B (new) ``` Net firmware.bin: 791263 → 791035 B (-228 B). The textual size of the sstream chains is preserved (we didn't drop any output) but the operator<< code is no longer duplicated through the createChannel prologue/epilogue. The two helpers are cold-path so `--gc-sections` keeps them tucked away from the hot allocation/encoder-creation block. This is the first of several extractions toward #2773 item 2.2 (split createChannel static vs. dynamic). The full static/dynamic split (with a static-init thread-local that lets `--gc-sections` drop the dynamic hot-plug body entirely) is still pending and tracked separately. Refs #2773. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Wondering what really moved? Review this PR in Change Stack to inspect semantic changes, definitions, and references. 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 (1)
📝 WalkthroughWalkthroughTwo noinline private helper methods ( ChangesRMT5 Diagnostic Logging Refactor
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 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)
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 |
Summary
fl::ChannelEngineRMTImpl::createChannelwas 6351 B on the esp32dev Blink build — the largest FastLED-owned symbol in the binary per the #2773 batch-2 audit. Two of its cold paths each built a ~15-linefl::sstreamwith multi-integer interpolation (recovery success + allocation failure messages); everyoperator<<instantiation was being textually inlined into createChannel.Move both into
__attribute__((noinline))member helpers. Pure code motion — same rodata, same FL_WARN/FL_ERROR severity, same on-the-wire output.Size measurements (fbuild esp32dev release Blink)
ChannelEngineRMTImpl::createChannelChannelEngineRMTImpl::emitRecoveryWarning(new)ChannelEngineRMTImpl::emitAllocationFailureError(new)The full multi-line texts are preserved (no diagnostic loss); the win is operator<< code no longer duplicated through createChannel's prologue/epilogue. The two helpers are cold-path, so
--gc-sectionskeeps them tucked away from the hot allocation/encoder-creation block.This is the first surgical pass at #2773 item 2.2. The full static/dynamic split (using a static-init thread-local so
--gc-sectionscan drop the dynamic hot-plug body entirely) remains pending and tracks separately.Test plan
fl::channels.Refs #2773 (memory-hunt loop, iter 2).
🤖 Generated with Claude Code
Summary by CodeRabbit