Repository navigation
Description
Follow-up to #2994. cc @nomakewan
#5350 removed the biggest part of the regression: FastLED.show() no longer waits for the whole frame to go out on the wire. The reporter confirmed this on a real ESP32-S3 at commit aac1367 (see the latest comments on #2994). show() is still about 5× slower than 3.10.3:
| Version | show() on ESP32-S3, 35× WS2812 |
vs 3.10.3 |
|---|---|---|
| 3.10.3 | ~110 µs | 1× |
| 3.10.10 | ~1860 µs | ~17× |
master aac1367 (after #5350) |
~545 µs (most 525–560) | ~5× |
What's left: CPU work, not waiting
The remaining ~435 µs is time the CPU spends inside show(). Breakdown of one show() on an ESP32-C6 forced onto the same RMT5 legacy path (bash autoresearch <env> --legacy --rmt, timingDriftTest), mean 369 µs:
| Phase | µs/frame |
|---|---|
showLedsInternal: pixel encoding and enqueueing |
~161 |
onEndFrame: mostly driver.show() (~108) |
~147 |
↳ in driver.show(): buffer copy |
~17 |
↳ in driver.show(): rmt_transmit() |
~34 |
↳ in driver.show(): acquiring and enabling the channel, resetting the encoder, waiting for ready |
~26 |
onBeginFrame |
~48 |
| other (throttle, begin/end show hooks) | ~15 |
3.10.3 did the whole job in ~110 µs on the S3, mainly via led_strip_refresh_async. The extra cost is spread across the layers of the newer path: ClocklessIdf5 → SlimBridgeController → ChannelManager → ChannelEngineRMT. No single blocking point is left.
Proposed work
- Profile each phase above on the RMT5 legacy path (C6 with
--legacy --rmtand/or an S3). - Cut the largest costs:
- pixel encoding and enqueue;
- per-frame ChannelManager /
beginFramebookkeeping; - per-frame channel acquire, enable and encoder reset (could these stay set up from frame to frame?).
- Add a regression threshold to
timingDriftTestbacked by board measurement. - Target: S3
show()close to the 3.10.3 baseline, about 2× or better at first.
Related: #5351 (separate ~2.3 ms per-frame cost on the C6/P4 PARLIO default path).
Generalized AutoResearch latency gate (requested)
#2994 went unnoticed across many releases because nothing on-device measures how long show() blocks. Add a driver-agnostic show() latency test to AutoResearch so that any future regression fails on the bench:
- What it measures. For each driver selectable in AutoResearch (
--rmt,--parlio,--spi,--i2s,--lcd,--legacy, ...), replay a fixed workload: N LEDs (e.g. 35 and 300),show()at a fixed cadence well above wire time. Recordshow()min, mean and max, plus a per-phase breakdown (begin frame, encode + enqueue, drivershow(), end-frame wait). This generalizes the existingtimingDriftTestRPC, which today only replays the [Bug] Compounded timing inaccuracy on master compared to 3.10.3 (Follow-up to #2420) #2994 sketch. - Pass/fail.
- Mean
show()must stay under a per-driver, per-chip CPU budget stored next to the test (like the bloat baselines), with a stated tolerance. - For async drivers,
show()must also stay well under the wire time. Ashow()that tracks wire time means it blocked on the transfer, which is the [Bug] Compounded timing inaccuracy on master compared to 3.10.3 (Follow-up to #2420) #2994 failure mode.
- Mean
- Where it runs. As a phase of the normal
bash autoresearch <board> --<driver>run, so every hardware validation of a driver also checks its latency, not just pixel correctness. - Baselines. Record one on each attached board (ESP32-C6 RMT/PARLIO today; an S3 when available). Raising a baseline needs a written reason, like
tests/data/*_bloat_baseline.txt.
Sub-issues
Collapse Sub-issuesSub-issues
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTriage
Activity
perf(channels): encode plain-RGB WS2812 frames straight from PixelCon…
zackees commentedon Nov 21, 2026
Progress update (ESP32-C6, 35 WS2812, forced-RMT legacy path,
timingDriftTest).Landed
show()meanPixelControllerrmt_tx_wait_all_done()after an ISR-confirmed frame (single-core chips only)show()on current master: about 205–220 µs on the C6. The starting point was 1687 µs before #5350 and 357 µs before #5358.What is left, and why single fixes no longer show up in wall time
I counted instructions per
show()with the Espressif RISC-V performance counter (PCER 0x7E0 in instruction mode):show()(after perf(rmt5): drop the redundant rmt_tx_wait_all_done() after an ISR-confirmed frame (#5356) #5364), against ~34k cycles. IPC is 0.36–0.42, so about 60% ofshow()time is stall cycles.show()-path functionsFL_IRAM(CFastLED, ChannelManager, RMT engine, buffer pool, peripheral wrapper). Meanshow()went from 213 to 205 µs and IPC stayed at 0.42. The stalls are therefore not instruction fetch from FastLED's own functions. Likely sources are ESP-IDF RMT/FreeRTOS calls, peripheral register accesses, critical sections and atomics.Remaining instructions per frame, measured before #5364:
rmt_transmit()(ESP-IDF)beginTransmission(sort,shared_ptrcopies, queue)acquireChannelNext candidate: stop polling and showing registered drivers that have no work.
Not done yet: the generalized AutoResearch latency gate proposed above.
perf(rmt5): single-channel fast path in beginTransmission (FastLED#5382…
zackees commentedon Dec 3, 2026
Final ESP32-C6 RMT & PARLIO
show()Latency Results (#5375 / #5492 item #22)Measured on ESP32-C6 @ 160 MHz (
timingDriftTest, 35 WS2812, 554show()calls):show()instr/show--legacy)PR #5510 tightens
esp32c6 RMTfrom280to175µs and addsesp32c6 PARLIO 360µs intests/data/show_latency_budget.txt.perf(autoresearch): tighten esp32c6 RMT show() latency budget to 175 …