Skip to content

perf(channels): keep fl::string off the IChannelDriver::poll() hot path (#5375) #5380

Closed

Description

@zackees

Sub-issue of #5375 (meta), part of #5356.

Problem

IChannelDriver::poll() returns DriverState by value, and it carries an fl::string error (src/fl/channels/driver.h). ChannelManager::poll() also keeps an fl::string firstError. They are built, copied and destroyed on every poll of every driver, several times per show() during the waits, even though the string is empty unless there's an error.

Fix

Take string construction off the poll path:

  • DriverState carries just the state enum (plus at most a static const char* or an error code).
  • Drivers expose the detailed error message through a separate accessor that is read only when the state is ERROR.
  • ChannelManager::poll() keeps no fl::string unless an error is actually seen.

Constraints

  • Keep the error message available to users: the reporting path still logs the driver's error text.
  • Update all drivers and mocks; the host tests for driver errors must keep passing.

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.

Activity

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

    @zackees
    MemberAuthor

    Picking this up from the fastled2 plan in #5375; branch perf/5380-poll-no-string

  3. moved this from Triage to Done in FastLED Trackeron Nov 22, 2026
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