Skip to content

perf(esp32): FastLED.show() still ~5x slower than 3.10.3 on ESP32-S3 RMT5 after #5350 (follow-up to #2994) #5356

Open
5 of 6 issues completed

Description

@zackees

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

  1. Profile each phase above on the RMT5 legacy path (C6 with --legacy --rmt and/or an S3).
  2. Cut the largest costs:
    • pixel encoding and enqueue;
    • per-frame ChannelManager / beginFrame bookkeeping;
    • per-frame channel acquire, enable and encoder reset (could these stay set up from frame to frame?).
  3. Add a regression threshold to timingDriftTest backed by board measurement.
  4. 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. Record show() min, mean and max, plus a per-phase breakdown (begin frame, encode + enqueue, driver show(), end-frame wait). This generalizes the existing timingDriftTest RPC, which today only replays the [Bug] Compounded timing inaccuracy on master compared to 3.10.3 (Follow-up to #2420) #2994 sketch.
  • Pass/fail.
  • 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

Sub-issues

5 of 6 Issues completed
Loading 6 sub-issues

Activity

  1. added
    sanitized
    on Nov 21, 2026
  2. zackees commented on Nov 21, 2026

    @zackees
    MemberAuthor

    Progress update (ESP32-C6, 35 WS2812, forced-RMT legacy path, timingDriftTest).

    Landed

    PR sub-issue change C6 show() mean
    #5358 #5357 encode plain-RGB WS2812 straight from PixelController 357 → ~219 µs
    #5360 #5359 keep a reused RMT channel enabled between frames −20 µs on the same build
    #5366 (in merge queue) #5364 skip the redundant rmt_tx_wait_all_done() after an ISR-confirmed frame (single-core chips only) −1.5k instructions/show

    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):

    Remaining instructions per frame, measured before #5364:

    item instr/frame
    rmt_transmit() (ESP-IDF) ~2.0k
    pixel encode (35 px) ~1.9k
    polling idle drivers (PARLIO, SPI, BIT_BANG, UART) ~1.2k
    RMT beginTransmission (sort, shared_ptr copies, queue) ~1.0k
    RMT acquireChannel ~0.9k
    everything else <0.5k each

    Next candidate: stop polling and showing registered drivers that have no work.

    Not done yet: the generalized AutoResearch latency gate proposed above.

  3. zackees commented on Dec 3, 2026

    @zackees
    MemberAuthor

    Final ESP32-C6 RMT & PARLIO show() Latency Results (#5375 / #5492 item #22)

    Measured on ESP32-C6 @ 160 MHz (timingDriftTest, 35 WS2812, 554 show() calls):

    Stage / Driver Mean show() Min / Max instr/show Est. IPC Budget
    Before #5350 (RMT) 1,687 µs — — — —
    After #5350 (RMT) 357 µs — — — —
    After #5358/#5360/#5364 (RMT) 205–225 µs — ~12,400 0.36 280 µs
    Pre-#5508 master (RMT) 144.8 µs 139 / 183 µs 8,377 0.36 280 µs
    Post-#5508 (#5378) master (RMT) 125.3 µs 124 / 172 µs 8,352 0.42 175 µs
    ESP32-C6 PARLIO (--legacy) 296.8 µs 292 / 420 µs 25,621 0.54 360 µs

    PR #5510 tightens esp32c6 RMT from 280 to 175 µs and adds esp32c6 PARLIO 360 µs in tests/data/show_latency_budget.txt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    sanitized

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions