Repository navigation
Closed
Labels
sanitizedTitle, body and conversation screened; review text requires separate screening.
Description
Summary
On ESP32-C6, the typed Channels path FastLED.add<fl::Bus::AUTO>(cfg) costs +46,962 B image flash / +1,067 B attributed RAM over the classic FastLED.addLeds<WS2812, PIN, GRB>(leds, N) driving the same strip on the same backend (PARLIO). Goal: cut that overhead by ≥50% (≥23.5 KB flash) in shared code, with no functional regression.
The erased FastLED.add(cfg) (+139,768 B) is out of scope: it deliberately enrolls every driver for runtime selection (#2459). add<Bus>() is the recommended path.
Measurements (esp32c6, bash bloat, fbuild 2.5.51, IDF 5.5.1, -Os, 60× WS2812 GPIO3, no Serial)
| Variant | Image flash | Attributed RAM |
|---|---|---|
A addLeds<WS2812,3,GRB> |
353,990 | 18,054 |
C add<Bus::AUTO>(ChannelConfig) |
400,952 | 19,121 |
| C − A | +46,962 | +1,067 |
B add(ChannelConfig) (erased, reference) |
493,758 | 20,687 |
Candidates (behavior-preserving, shared code)
- Protocol encoder fanout.
Channel::selectPixelEncoder(src/fl/channels/channel.cpp.hpp:214-264) takes the address of every clockless/SPI encoder, so a WS2812 channel retainsencodeUCS7604(948 B),Gamma8Impl/Gamma8::getOrCreate,GAMMA_2_8_LUTand the gamma16 LUT (~5.8 KB). Bind the encoder from the chipset type at the typed construction boundary; keep the erased selector for runtime chipsets. Est. 5–10 KB. - Channel event lists. Nine
fl::function_listlists inchannel_events.hare always invoked, with invoke/compact/sort instantiated per signature (~8.4 KB by name, 364 B static RAM). Share the non-template list machinery and keep a zero-cost no-subscriber path. Preserve priority, removal during dispatch and late subscription. Est. 3–7 KB. - RGBW power/convert hooks on RGB channels.
Channel::syncLegacySettings(channel.cpp.hpp:391-410) referencesenable_rgbw_power_estimate/ RGBW conversion, retaining the RGBW estimator and a 513 B scaling LUT cache without any limiter. Install these only when RGBW is configured, keeping the directmWhiteCfgassignment semantics. Est. 0.8–2 KB flash, 517 B RAM. - Diagnostics. Long
FL_ERRORstrings inresolveDynamicDriver,emitDisabledDriverErrorand the manager. Share fragments and keep the messages useful. Est. 1–5 KB. - Driver resolution / profile plumbing.
resolveDynamicDriver,selectDriverForChannel,reconcileColorProfile. Pin the driver for typed channels, invalidated on registry or config change. Est. 0.4–1.5 KB.
Acceptance
- Re-measure A vs C with identical wrapper, profile and toolchain; C − A flash ≤ 23,481 B.
bash test --cppgreen; channel, manager, event, power, color-profile, wave3/wave8 and spi_legacy_golden tests unchanged or strengthened.- fbuild build + deploy + on-device test of the C sketch on an attached ESP32-C6 (pixels output via AutoResearch).
- No change to erased
add(cfg)semantics.
Investigation artifacts: phase-1 report by a Codex worker (A/B/C ELFs, maps, symbol deltas).
Metadata
Metadata
Assignees
Labels
sanitizedTitle, body and conversation screened; review text requires separate screening.
Type
Projects
- StatusShow more project fieldsDone
Activity
fix(channels): address typed footprint review findings (#5157)
fix(channels): share construction and protect callback lifetimes (#5157)
fix(channels): defer event mutation and snapshot factory metadata (#5157
fix(stl): make callback retirement and active moves reentrant (#5157)
zackees commentedon Nov 8, 2026
Maintainer directive: build-file changes for PR #5163
The maintainer (repo owner) authorized these build changes in the coordinating session on 2026-11-08, choosing "Authorize, post directive":
src/fl/channels/_build.cpp.hpp: include the newencoder_availability.cpp.hpp. The library alone ownsFASTLED_DISABLE_*encoder availability, which fixes the ODR mismatch between the typed and erased paths.src/fl/stl/_build.cpp.hpp: the unity-router include for thefunction_listsupport code.tests/meson.build: no-PCH flags for thefl_channels_encoder_availabilityandfl_stl_function_listtests (caller macros intentionally differ from the library's), plus the probed allocator--wrapused by the allocation-failure test.The directive covers only these changes, which exist to support the new source file and the regression tests in #5163.
perf(channels): halve typed API flash overhead (#5157)
fix(channels): address typed footprint review findings (#5157)
fix(channels): share construction and protect callback lifetimes (#5157)
fix(channels): defer event mutation and snapshot factory metadata (#5157
fix(stl): make callback retirement and active moves reentrant (#5157)
fix(stl): keep pending subscriptions when moving a dispatching functi…
perf(channels): halve typed API flash overhead (#5157)
fix(channels): address typed footprint review findings (#5157)
fix(channels): share construction and protect callback lifetimes (#5157)
fix(channels): defer event mutation and snapshot factory metadata (#5157
fix(stl): make callback retirement and active moves reentrant (#5157)
fix(stl): keep pending subscriptions when moving a dispatching functi…
perf(channels): cut typed add<Bus>() flash overhead vs addLeds<> by 5…