Skip to content

perf(rmt5): measure and slim the static allocation ledger #4567

Closed

Description

@zackees

Context

FASTLED_RMT_STATIC_ALLOCATION=1 is an opt-in for a fixed strip initialized during setup, with no later add/remove or network-driven channel reconfiguration. The user-facing size guide measures only 908 B saved by the flag in its reference build. In current source, RmtMemoryManager::MemoryLedger still owns fl::vector_inlined<ChannelAllocation, 8> (rmt_memory_manager.h:412), and allocateTx, free, reset, and query paths still manipulate/iterate its allocations (rmt_memory_manager.cpp.hpp).

#2856 item 3.6 proposed replacing an older fl::vector ledger under static allocation. The storage has since become vector_inlined<..., 8>, so that proposal needs a fresh measurement and an updated implementation target rather than copying its old size estimate.

Proposal

Measure the static-mode ledger's RAM and flash cost on ESP32-S3 Blink, then specialize only the static allocation path to use the minimum tracking its documented contract requires. Evaluate a single record or fixed slot(s) against the existing inlined vector, including whether growth/erase code is actually linked. Preserve the adaptive ledger for normal dynamic mode.

Acceptance criteria

  • RED: a focused static-mode symbol/object-size report and tests identify the ledger operations and storage retained today; a size assertion for the chosen target fails before implementation.
  • GREEN: same-toolchain static-mode Blink reports a positive net flash or RAM saving with no regression in dynamic-mode Blink. Record both symbol and whole-firmware deltas; do not land a more complex representation if no measurable saving exists.
  • Tests cover successful setup-time TX allocation, allocation failure, reset/accounting queries used under static mode, and the documented late-add/remove constraint; dynamic mode still handles multiple TX/RX channels.
  • Documentation states the static-mode limits and measured gain from the new representation.

Decisions

  • P3: the current static flag already saves 908 B, and the remaining ledger win is unmeasured.
  • Restrict the change to FASTLED_RMT_STATIC_ALLOCATION=1; removing dynamic accounting would change supported runtime behavior.
  • Re-audit vector_inlined rather than assume Meta: ESP32-S3 binary-size reduction — Batch 3 (successor to #2773) #2856's older plain-vector estimate still applies.

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions