You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(channels): skip the redundant second wait when all drivers are already READY (#5375) #5381
the next frame's onBeginFrame() calls waitForReady().
Each wait polls all drivers at least once, even when the previous wait already found every driver idle and nothing has been enqueued since.
Fix
Cache "all drivers READY" in the manager. Clear it on enqueue, on show() and on driver registration. When it's still set, the next waitForReady() returns immediately without polling.
Constraints
It must never return early while a driver is busy. A driver whose completion is asynchronous (an ISR finishing a transfer) moves from BUSY to READY without the manager doing anything, so the cache may only be set by a poll that saw READY, and anything that can create work must clear it.
Add host tests showing:
the second wait in a frame doesn't poll;
a busy driver is always waited on.
Rules for this sub-issue (from the meta issue)
Keep the layered architecture. Fix this inside its layer. Don't bypass ChannelManager or the channel engine.
Accept on instructions, not wall time. Measure instructions per show() on the ESP32-C6 before and after. Use bash autoresearch esp32c6 --legacy --rmt with the counter from the measurement sub-issue. Put both numbers in the PR. Code layout alone moves wall time by 10–20 µs between builds, so a wall-time number on its own can't show a 5–10% cut.
Usual gates:
bash test --cpp;
bash lint;
a passing AutoResearch run with the show() latency gate on;
bash bloat esp32s3 --build, with no growth past the ratchet.
Keep it small. Don't grow the binary on small-memory tiers (AVR, ATtiny). If a new bulk kernel doesn't pay for itself on FL_PLATFORM_HAS_TINY_MEMORY builds, compile it out of them.
Correction to the claim in #5424, after a triage pass from #5375.
ChannelManager::poll() is called only from waitForState(). Nothing polls between frames. That means mAllReady can be set only by the poll in onEndFrame(), which runs immediately after show() starts the transmit.
Asynchronous DMA drivers (RMT5, PARLIO, SPI, …): that poll sees DRAINING; perf(rmt5): single-channel fast path in beginTransmission (#5382) #5419 measured 4,432 of 4,432. The next frame's onBeginFrame() poll is then the first one that can see READY, so it is never skipped, at any frame rate. Idle time between frames doesn't help, because no poll runs in that gap to observe READY.
The change is safe, so I'm keeping it, but the "common case at normal frame rates" claim and the onBeginFrame() code comment ("onEndFrame() usually already saw every driver READY") don't hold for the ESP32 DMA drivers. The comment will be corrected in the next #5375 PR. Expected change on the C6 legacy-RMT benchmark: none, which matches #5424's own note.
Activity
zackees commentedon Nov 22, 2026
Taking this (orchestrator clud-1167194); branch perf/5381-skip-ready-wait; host-only, ChannelManager wait code only.
zackees commentedon Nov 22, 2026
Correction to the claim in #5424, after a triage pass from #5375.
ChannelManager::poll()is called only fromwaitForState(). Nothing polls between frames. That meansmAllReadycan be set only by the poll inonEndFrame(), which runs immediately aftershow()starts the transmit.onBeginFrame()poll is then the first one that can see READY, so it is never skipped, at any frame rate. Idle time between frames doesn't help, because no poll runs in that gap to observe READY.show()finishes the transfer before returning: the end-of-frame poll sees READY, and the frame-start poll is skipped. That is the only case where perf(channels): skip the redundant frame-start wait when all drivers are already READY (#5381) #5424 saves work.The change is safe, so I'm keeping it, but the "common case at normal frame rates" claim and the
onBeginFrame()code comment ("onEndFrame() usually already saw every driver READY") don't hold for the ESP32 DMA drivers. The comment will be corrected in the next #5375 PR. Expected change on the C6 legacy-RMT benchmark: none, which matches #5424's own note.perf(channels): skip the redundant frame-start wait when all drivers …
fix(channels): cache all-ready only when every driver reported READY (F…