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(rmt5): skip the no-op configureChannel() when reusing a channel on the same pin (#5356) #5362
Sub-issue of #5356 (show() latency on the ESP32-C6 forced-RMT legacy path).
Cause
ChannelEngineRMTImpl::acquireChannel() Strategy 1 reuses the idle channel already bound to the requested pin. It still calls configureChannel() on every frame. For a channel on the same pin with the same timing, that call does no work: it finds no pin change and no timing change, and it creates nothing. But it is a large, non-inlined function in flash. On the C6, entering it costs instruction-cache misses on every frame.
Measurement
The measurement ran on an ESP32-C6 with 35 WS2812, using cycle-counter phase timers. The build already contained #5357 and #5359.
µs/frame
acquireChannel
24.8
of which configureChannel (no-op)
15.6
of which reclaimPin
2.4
Skipping the call when the pin and timing are unchanged:
acquireChannel drops to 10.5 µs/frame.
Instrumented show() mean drops from 264.5 to 241.6 µs.
Fix
In Strategy 1, call configureChannel() only when the timing differs. The pin already matches by construction.
Closing without a PR. Once rebased onto current master (with #5360), the change made show() slower on the ESP32-C6, not faster: master 4a791c4 measured 306 / 317.2 / 614 us (min / mean / max); master plus the configureChannel skip measured 319 / 336.3 / 629 us. On the older master it measured 356.5 -> 346.2 us. The ~15 us the phase timers attributed to configureChannel() is flash instruction-cache placement, not work the call performs, so it moves with code layout from build to build. Shifts of this size (10-20 us) are within code-layout noise on this target. Follow-ups under #5356 will target per-frame work that actually executes (locks, list walks, allocations).
Activity
zackees commentedon Nov 21, 2026
Closing without a PR. Once rebased onto current master (with #5360), the change made show() slower on the ESP32-C6, not faster: master 4a791c4 measured 306 / 317.2 / 614 us (min / mean / max); master plus the configureChannel skip measured 319 / 336.3 / 629 us. On the older master it measured 356.5 -> 346.2 us. The ~15 us the phase timers attributed to configureChannel() is flash instruction-cache placement, not work the call performs, so it moves with code layout from build to build. Shifts of this size (10-20 us) are within code-layout noise on this target. Follow-ups under #5356 will target per-frame work that actually executes (locks, list walks, allocations).