Repository navigation
perf(rmt5): cold-helper split for createChannel recovery loop (#2773 item 2.2) - #2838
Conversation
…lper (#2773 item 2.2) Same pattern that worked for #2773 item 2.1 in PR #2830: the progressive memory-reduction retry loop inside ChannelEngineRMTImpl::createChannel is a cold path (only reached when the initial allocation fails — typically never, in the static addLeds<>-at-boot scenario), but its body contains FL_LOG_RMT/FL_WARN operator<< instantiations plus a per-iteration Rmt5ChannelConfig constructor that the linker has to keep live inside the hot function body. Move the retry block into attemptAllocationRecovery(), an FL_NO_INLINE member helper. The hot path (initial allocation succeeds) shrinks proportionally; the cold path is unchanged behaviorally. Also fix a pre-existing C++17 nested-namespace error in src/fl/net/network_detector.h that broke local quick-mode test builds under -Wc++17-extensions. (CI uses C++17+ so it didn't catch it.) Target: ~1-2 KB Blink savings on ESP32-S3.
|
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 (2)
📝 WalkthroughWalkthroughThis PR contains two independent refactoring updates: a namespace declaration style change to the network detector header, and extraction of RMT5 channel memory-allocation recovery logic into a dedicated cold-path helper method to simplify the hot path. ChangesNetwork and RMT5 Refactoring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
…NLINE cold helper (#2773 item 2.5 — easy share) Same cold-helper pattern that worked for #2773 items 2.1 (PR #2830) and 2.2 (PR #2838). Hot path of allocateTx (initial tryAllocateWords succeeds — the common Blink boot case where there's plenty of TX memory) was bloated by the single-buffer fallback retry + 4 FL_WARN diagnostic lines + 3 conditional suggestion blocks, all of which reach for fl::sstream operator<< chains. Extract them into handleAllocateTxFailure(), an FL_NO_INLINE member helper. Hot path now ends at: if (!tryAllocateWords(words_needed, true)) { return handleAllocateTxFailure(channel_id, mem_blocks, words_needed, networkActive); } Cold path is behaviorally unchanged. This captures the easy share of #2773 item 2.5's ~3-4 KB target. The full template-trait refactor (skip the runtime planner entirely when addLeds<> is called exactly once with a known length) is still TODO but is a multi-day effort with template-instantiation risk.
Summary
ChannelEngineRMTImpl::createChannelinto a newFL_NO_INLINE attemptAllocationRecovery()cold helper. Hot path (initial allocation succeeds, the common static-addLeds<>-at-boot case) shrinks proportionally; cold path is behaviorally unchanged.src/fl/net/network_detector.hthat broke local quick-mode test builds under-Wc++17-extensions. (CI uses C++17+ so it didn't surface there.)Same pattern that worked for #2773 item 2.1 in #2830 — the helper isolates the FL_LOG_RMT/FL_WARN
operator<<instantiations and a per-iterationRmt5ChannelConfigconstructor that the linker would otherwise have to keep live insidecreateChannel's body.Target: ~1–2 KB Blink savings on ESP32-S3.
Closes one bullet on the #2773 punch list.
Test plan
bash lint— cleanbash test --cpp— 309/310 pass; the 1 unrelated failure (spi_pingpong_pipeline_logic— UB in the test's polling-path simulation, introduced by feat(spi,esp32): pre-queue alternate-buffer SPI chunk for >680-LED strips (refs #2304) #2810) is pre-existing on master and is out of scope here.build,test, esp32s3 compile-many)createChannelshrunk🤖 Generated with Claude Code
Summary by CodeRabbit