Skip to content

META: memory & flash reduction -- Phase 3 burn-down (continues #3235) #3244

Closed

Description

@zackees

Sub-issues (loop-enumerable)

Cross-repo, informational only (not in the burn-down loop):


Goal

Continue FastLED's "smallest possible embedded footprint" arc. Predecessor metas #3224 (LPC845 Phase 2) and #3235 (type-erasure burn-down) shipped 11 PRs that cumulatively recovered ~17 KB of flash + ~3 KB of RAM on Low-memory targets and ~10 KB of flash + ~2 KB of RAM on a Large-memory target (Teensy 4). Several items in those metas were caught short — either because the audit-predicted leverage doesn't materialize at AutoResearch scale, or because the implementation surface is invasive enough to warrant its own focused PR series. This meta rolls them all into one open burn-down so future agents have a single page to look at instead of spelunking through closed-meta bodies.

Carry-forward from #3235 (unfiled sub-items)

Tier Title Predicted savings Difficulty Notes
1A RuntimeRpcBinding -- replace TypedRpcBinding<Sig> with non-template binding + per-Sig trampoline ~1.5-1.8 KB / Sig medium-hard Tier 3H from #3224, the original "deferred-as-invasive" item. Biggest single remaining leverage point. Per-Sig template tax -> per-Sig trampoline (50-150 B). Phase via FL_PLATFORM_HAS_LARGE_MEMORY opt-in; ESP32/Teensy hot path can keep templates if benchmarks show speed regression.
2E (Phase 2) json_convert_to_<int/bool/float/string>_core non-template visitor cores ~2-3 KB on LPC845, ~5+ KB on Large-memory medium Phase 1 (Size + IsArray visitors -> tag-table lookups) landed in PR #3241 saving 416 B. Phase 2 is the bigger win: collapse JsonToIntegerVisitor<T> / JsonToFloatVisitor<T> / JsonToBoolVisitor / JsonToStringVisitor -- which each emit 10 per-alternative operator() overloads -- into 4 non-template conversion cores.
2F ClocklessControllerRuntime -- runtime-timing variant for ESP32/Teensy/RP2040/WASM ~8-25 KB on Blink-style sketches with multiple chipsets medium-hard Preserves FastLED.addLeds<CHIPSET, PIN, ORDER>(...) user API surface. AVR / LPC8xx / ESP8266 keep template path (cycle-tight bit-banging needs compile-time constants). Gated via FL_USE_RUNTIME_CLOCKLESS. Different leverage axis (per-chipset, not per-Sig).
3G Variant trivial-destructor / trivial-copy collapse ~2-3 KB on variant-heavy targets (json_value) hard Share destroy_fn across is_trivially_destructible<T> types (collapse to noop_destroy). Share copy_fn / move_fn across trivially-copyable types (one shared memcpy(storage, other, size) thunk parameterized at runtime by sizeof(T)).
3H deque_basic shadow class ~150 B per future instantiation easy Mirror vector_basic / flat_map_basic pattern. Only 1-2 deque instantiations today (deque<char> for json, deque<u8> for parlio). Limited immediate ROI but cheap to land alongside any future deque addition.
3I Visitor warning-string outlining ~1-2 KB across visitors easy Each visitor today inlines fl::to_string(value, 6) warning formatters that anchor basic_string machinery. Outline to a single format_warning_value(tag, storage) helper that only links if any visitor actually emits a warning at runtime.

Open standalone follow-ons

Issue Title Why it matters
#3237 fl::function HeapHolder<F> shared_ptr-vs-unique_ptr investigation Filed when user flagged the heap allocation tradeoff during #3238 review. Determines whether copying an fl::function should refcount-increment (current behavior) or deep-copy the captured F. Affects every embedded target's RAM model.
#3228 Rename __async / __skip RPC envelope markers Cosmetic / readability follow-on from #3224 Tier 1B. The __-prefix looks reserved-namespace but the fields are public envelope-control flags. No flash impact but improves code review velocity on RPC paths.
fbuild#627 fbuild daemon crash under multi-worktree contention Recurring bug that costs ~10 min/session on the type-erasure work. Not a FastLED-side issue but the friction directly affects iteration on this meta.
fbuild#594 bash bloat arm-none-eabi path Mostly addressed by #3225 (arm support landed) and the --allow-overflow flag. Documented here so future agents know it's a usable workflow.

Lessons learned from #3235 (worth re-stating up front)

  1. The audit's per-tier savings predictions assumed "kitchen-sink" builds with ~30 distinct container instantiations. AutoResearch has 2 of each (flat_map, unordered_map). At that scale, per-call thunk overhead can equal or exceed per-instance savings. PR perf(flat_map): type-erase lower_bound / upper_bound binary search (#3235 Tier 2D) #3239 (flat_map_basic) was +72 B on LPC845; the infrastructure is correct and will pay back on bigger sketches, but agents reading the audit shouldn't expect immediate flash deltas on focused sketches.

  2. fl::function is the exception that proved the rule. Per-Sig variant tax compounds across the ~25-30 signatures every embedded build instantiates -- and PR perf(fl::function): Option B refactor -- single SBO + invoker + manager (#3235 Tier 1B, -9.2 KB Teensy 4) #3238 (Option B) measured −9.2 KB on Teensy 4 just as the audit predicted. The leverage axis (per-Sig × variant-alternative) is fundamentally denser than per-container.

  3. Big sketches matter for measurement. The 5-sketch matrix queue from the original meta investigation (AutoResearch / Animartrix / Chromancer / Json / FxNoiseRing) never completed because bash bloat esp32s3 --build hit fbuild#627 daemon wedges. A future agent should retry with one of the genuinely large WASM-compiler or full-RPC sketches before tackling Tier 1A/2F.

  4. FL_NO_INLINE on type-erased cores is load-bearing under LTO. Without it the compiler inlines the body back at each call site, defeating dedup. Lint gate exists (bare_noinline_checker.py) — use it.

Recommended priority order

  1. Tier 1A (RuntimeRpcBinding) — biggest single PR leverage that hasn't been touched. AutoResearch already exercises 4 RPC signatures; LPC845 measurement should show ~6 KB savings if the audit's per-Sig estimate is correct.
  2. fl::function: investigate heap-allocation tradeoffs of the HeapHolder<F> + shared_ptr fallback (Option B follow-on) #3237 investigation — orthogonal to flash work but blocks further fl::function evolution. Quick to resolve (1-2 hours of measurement + write-up).
  3. Tier 2E Phase 2 — Phase 1 validated the dispatch-core approach (PR perf(json): SizeVisitor + IsArrayVisitor → direct tag checks (-416 B LPC845; #3235 Tier 2E) #3241, −416 B). The Phase 2 conversion-visitor cores are mechanically similar but bigger payoff.
  4. Tier 2F (ClocklessControllerRuntime) — different leverage axis; sketches with multiple chipsets (Blink-style, RGBCalibrate) will demonstrate. Requires a non-AutoResearch target sketch for verification.
  5. Tier 3 G/H/I — small wins; bundle into one cleanup PR or defer indefinitely.

Acceptance for closing this meta

Per-item acceptance, not a blanket count (lessons-learned from #3235):

When ≥3 of the Tier 1/2 items are closed + at least one of #3237 / #3228 is resolved, the meta is considered burned down and may be closed.

Tooling status

Out of scope

Predecessors

This meta is Phase 3 of the same arc.

Activity

  1. zackees commented on Jun 18, 2026

    @zackees
    MemberAuthor

    ⚠ /clud-fix intake gate failed. This comment is the deliverable, not a merged PR. If a session /goal hook references this issue URL, run /goal clear after reading — it will NOT auto-satisfy.

    What is going wrong

    The /clud-fix skill's meta workflow enumerates open sub-issues by parsing the meta body for markdown checklist items with issue references (e.g. - [ ] #123, - [ ] owner/repo#456). This meta's body uses markdown tables to catalog the Phase 3 work items (Tier 1A, 2E Phase 2, 2F, 3 G/H/I), not checklist items. The enumerator finds nothing actionable.

    Concretely, the meta references 9 distinct work items but only 4 of them exist as filed GitHub issues:

    Work item Filed issue Checklist-referenced?
    Tier 1A (RuntimeRpcBinding) not filed n/a
    Tier 2E Phase 2 (json conversion-visitor cores) not filed n/a
    Tier 2F (ClocklessControllerRuntime) not filed n/a
    Tier 3G (variant trivial-destructor/copy collapse) not filed n/a
    Tier 3H (deque_basic) not filed n/a
    Tier 3I (visitor warning-string outlining) not filed n/a
    HeapHolder shared_ptr tradeoff #3237 no — only in prose
    __async envelope rename #3228 no — only in prose
    fbuild daemon contention FastLED/fbuild#627 no — only in prose (cross-repo)

    The skill's documented "When Not To Use This" list catches this exact case:

    The "meta issue" is really a roadmap / wish-list with no concrete sub-issues filed yet → ask the user to file the sub-issues first (or use [[clud-issue]] to file them), then re-invoke this skill on the meta.

    Reproduction status

    Not applicable (this isn't a code bug). The intake gate failed because the meta's structure doesn't match what the enumerator looks for. No code change happens; no PR is opened.

    I am not going to auto-file the missing sub-issues from the meta's catalog. The skill's "Manufacturing meta-level work" failure mode explicitly forbids that:

    When the open-sub-issue list goes empty, stop and report. Do not start filing or guessing at new sub-issues to extend the run.

    This is the right call — sub-issues need their own intake-gate-passing repros / acceptance criteria, and several Phase 3 items (especially Tier 1A RuntimeRpcBinding and Tier 2F ClocklessControllerRuntime) are design exercises that warrant user-in-the-loop discussion before being filed against. Auto-filing would bypass the design step.

    Planned fix (what would unblock the burn-down)

    The meta needs two structural changes before /clud-fix can drive it:

    1. File the catalog items as separate issues. Each row in the "Carry-forward from META: type-erasure burn-down -- collapse template-instantiation taxes across containers / RPC / visitors / fl::function / chipset controllers #3235" table becomes its own issue with:

    2. Convert the prose references to a markdown checklist in the meta's body, like:

      ## Sub-issues
      - [ ] #<N1> Tier 1A — RuntimeRpcBinding
      - [ ] #<N2> Tier 2E Phase 2 — json conversion-visitor cores
      - [ ] #<N3> Tier 2F — ClocklessControllerRuntime
      - [ ] #<N4> Tier 3G — variant trivial-destructor/copy collapse
      - [ ] #<N5> Tier 3H — deque_basic
      - [ ] #<N6> Tier 3I — visitor warning-string outlining
      - [ ] #3237 — HeapHolder shared_ptr tradeoff
      - [ ] #3228 — __async envelope rename
      - [ ] FastLED/fbuild#627 — daemon contention (cross-repo; informational)
      

      That format is what the /clud-fix enumerator parses. The current table-based catalog reads better for humans but is invisible to the skill.

    Open questions

    1. Should I file the 6 unfiled Tier sub-issues now? They'd be one-shot mechanical files derived from the existing meta + sub-agent audit reports — no design judgment beyond what the audits already provided. Risk: each sub-issue might inherit the audit's "predicted ~X KB" framing rather than acknowledging the lesson-learned that those numbers don't hold at AutoResearch scale; that wording should be tightened per-issue rather than copy-pasted.

    2. Or do you want to file them yourself, one at a time, gating each on a design conversation? Tier 1A is the highest-leverage and the most invasive — it deserves a conversation before being filed against. Tier 3H (deque_basic) and 3I (visitor warning outline) are pure mechanical follow-ons that could be filed in bulk.

    3. Do you want the prose-only references converted to a checklist in the meta body, so future /clud-fix invocations enumerate correctly even if some items remain unfiled? That edit is safe and reversible.

    What I'm NOT doing

    • Not auto-filing the 6 missing sub-issues (per the "Manufacturing meta-level work" failure mode).
    • Not running /clud-pr on any Tier item directly without it first being a separate issue (the skill is meta-driven; bypassing that would skip the per-sub-issue intake gate).
    • Not editing the meta body to add a checklist without your confirmation (the meta is your roadmap; restructuring it should be an explicit ask).

    Recommendation

    The fastest path forward in this session is: confirm one of the above options. Most likely useful:

    Either way, this comment exists so the next entry point (you or a future agent) has the precise state and the unblock plan in writing.

  2. zackees commented on Aug 20, 2026

    @zackees
    MemberAuthor

    Phase 3 burn-down is complete under this meta's stated terminal rules.

    Final child disposition:

    This satisfies the meta acceptance gate: every Tier 1/2 item is merged or explicitly deferred with rationale, at least three Tier 1/2 items have terminal dispositions, all Tier 3 items are closed, and both standalone follow-ons are resolved. Any future work on #3248 remains independently tracked and excluded from the actionable queue while labeled deferred.

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

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions