Skip to content

perf(show): trim per-frame controller plumbing (colour adjustment, checks, hooks) (#5375) #5384

Closed

Description

@zackees

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

Problem

About 1.4k instructions per show() go to controller plumbing before and after the encode:

  • colour adjustment and brightness setup;
  • the enabled and in-use checks per controller;
  • the end-of-show hooks (CFastLED::show → SlimBridgeController → ChannelManager frame hooks).

Much of it is recomputed every frame although its inputs rarely change.

Fix

Profile this section with the instruction counter, then cut what repeats:

  • cache the colour adjustment when brightness and correction haven't changed;
  • hoist per-controller checks out of the per-strip loop;
  • make empty end-of-show hooks cost nothing.

The concrete list comes from the profile; file anything large as its own sub-issue under the meta issue.

Constraints

  • No change in output: the colour, brightness, dither and temporal-dither tests must pass unchanged.

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.
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