Repository navigation
Description
Goal
Take ESP32-S3 NEOPIXEL Blink from 388,380 B flash baseline (master 2026-05) toward ≤ 280,000 B (-28%) via knob flips, default changes, and dead-code suppression. No public API changes.
Single source of truth:
docs/SLIM_ESP32S3.mdis the live tracker for every shipped + projected flag and its measured savings. This issue mirrors it as a coordinated checkpoint; for the per-flag detail (mechanism, constraint, measured bytes, owning PR) read SLIM.
Tool used to generate every number / file path / line citation in this issue:
bash bloat esp32s3 --top 25
# → .build/symbols/esp32s3/{report.json, report.md}Background analysis lives in agents/docs/binary-size-analysis.md. This issue supersedes #2885.
Current state (mirrors docs/SLIM_ESP32S3.md flag tracker)
Each row is an independently-mergeable knob with a measured-or-projected size impact. Status ✅ = merged + measured; 📊 = merged + projection-only; ⏳ = not started.
| # | Knob | Mechanism | Measured / projected | Status | Owning PR |
|---|---|---|---|---|---|
| 1 | FASTLED_LOG_VERBOSITY=0 |
Default-on for release (NDEBUG); restore with -DFASTLED_LOG_VERBOSITY=1 |
−50,391 B (cascade) | ✅ | #2890 |
| 2 | tools/sdkconfig_for_smallest_fastled.defaults |
board_build.sdkconfig_defaults in platformio.ini; bundles CONFIG_NEWLIB_NANO_FORMAT=y |
−59,224 B | ✅ | #2896, #2915 |
| 3 | -DFASTLED_RMT_STATIC_ALLOCATION=1 |
build_flags; only for sketches that init in setup() and never removeLeds() |
−908 B (below projection) | ✅ | #2846 |
| 4 | -DFASTLED_SUPPRESS_ARDUINO_CHIP_DEBUG_REPORT=1 |
build_flags; strong-overrides the Arduino-ESP32 weak shouldPrintChipDebugReport() |
~3 KB | 📊 | #2894 |
| 5 | CONFIG_BT_ENABLED=n |
Uncomment the situational block in tools/sdkconfig_for_smallest_fastled.defaults |
~15 KB (if currently on) | 📊 | — |
| 6 | -DFASTLED_DISABLE_SPI_CHIPSETS=1 |
build_flags; drops SPI dispatch branch in Channel::showPixels. Constraint: clockless-only sketches |
~1.0-1.2 KB | 📊 | #2913 |
| 7 | -DFASTLED_DISABLE_UCS7604=1 |
build_flags; drops UCS7604 cases in Channel::showPixels's clockless switch |
−3,804 B (6-9× projection) | ✅ | #2920 |
| 8 | -DFASTLED_DISABLE_DYNAMIC_DRIVER=1 |
build_flags; gates out Channel::resolveDynamicDriver() lookup chain |
−937 B | ✅ | #2926 |
| 9 | -DFASTLED_DISABLE_CHANNEL_EVENTS=1 |
build_flags; replaces 7 fl::function_list event slots with no-op fallbacks |
−8,034 B (4-8× projection) | ✅ | #2931 |
Cumulative measured progress on default sketch: 388,380 B → 338,117 B (-50,263 B / -13%). Achievable by enabling all 📊 rows above is an estimated additional ~20-25 KB, putting us within the 280 KB target window assuming Row 5 (BT disable) is acceptable for the sketch.
Remaining open work (after the SLIM tracker)
Items that don't fit the per-flag mould — they're code-change interventions that need their own PR rather than a build_flags toggle:
Stage 4 — Cold-helper audit of remaining FastLED hot paths (~3-5 KB)
After Stage 1 collapsed the FL_WARN strings, residual code bytes are what's left. Audit targets:
fl::ChannelManager::addDriverand friends — file:line refs in the Top 25 table below.fl::Channel::resolveDynamicDriver(already gated by Row 8 above but the gated-off path could shrink further).Rmt5EncoderImpl::initializewarn-cluster — projected ~1 KB once the printf-style log backend lands (sibling Meta: ESP32-S3 binary-size reduction — Batch 3 (successor to #2773) #2856 item 3.2).
Status: ⏳ not started.
Stage 5 — fl::basic_string::write simplification (~0.5-1 KB)
src/fl/stl/basic_string.cpp.hpp:193 defines three write(const char*, fl::size) overloads (lines 193, 198, 200) that share most of their machinery with formatted-stream code paths. Simplification should consolidate them.
Status: ⏳ not started.
Stage 6 — Verification gate
CI bloat regression gate with ratcheting baseline. Status: ✅ shipped in #2900 (#2949 ratchet, #2906/#2936/#2959 doc updates).
Top 25 symbols (flash) — historical reference
The original size analysis is preserved here for reference; the file:line citations remain valid even after the staged shipments above.
firmware.bin (pre-Stage-1) = 388,380 B flash + 37,460 B RAM; 3,685 sized flash symbols.
Top archives (pre-Stage-1)
| Bytes | % | Archive |
|---|---|---|
| 87,271 | 22.5 % | libFastLED.a |
| 60,254 | 15.5 % | (sketch) main.cpp.o |
| 54,458 | 14.0 % | libc.a (newlib printf engine) |
| 18,198 | 4.7 % | libesp_hw_support.a |
| 15,743 | 4.1 % | libFrameworkArduino.a |
| 14,091 | 3.6 % | libfreertos.a |
| 13,886 | 3.6 % | libhal.a |
| 13,387 | 3.4 % | libesp_driver_uart.a |
| 11,842 | 3.1 % | libesp_system.a |
| 11,348 | 2.9 % | libspi_flash.a |
| 8,193 | 2.1 % | libespcoredump.a |
| 7,377 | 1.9 % | libnvs_flash.a |
Top 25 symbols (pre-Stage-1)
| # | Bytes | Symbol | Defined at | Where the bytes went |
|---|---|---|---|---|
| 1 | 58,770 | fl::ClocklessIdf5<3, WS2812_800KHZ, GRB, 0, false, 280>::ClocklessIdf5() |
src/platforms/esp/32/drivers/rmt/rmt_5/idf5_clockless.h:33 |
75 FL_WARN/FL_LOG sites in channel_driver_rmt.cpp.hpp; 59 in rmt_memory_manager.cpp.hpp; 6 in channels/manager.cpp.hpp; 5 in channels/channel.cpp.hpp. Largely collapsed by Stage 1 (Row 1) — restore with FASTLED_LOG_VERBOSITY=1. |
| 2-7 | ~36 KB | newlib _vfprintf_r cluster |
libc.a |
Replaced by CONFIG_NEWLIB_NANO_FORMAT=y (Stage 3 / Row 2). |
| 15 | 2,002 | fl::ChannelManager::addDriver(int, fl::shared_ptr<IChannelDriver>) |
src/fl/channels/manager.cpp.hpp:51 |
FL_WARN/FL_DBG at lines 53, 62, 76, 82, 95, 131. Mostly addressed by Stage 1. Remaining Stage 4 target. |
| 18, 25 | 1,835 + 1,103 | esp_core_dump_* |
esp-idf libespcoredump.a |
Disabled by CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH=n (Stage 3 / Row 2). |
| 19 | 1,604 | diag_log_add |
esp-idf | Disabled by CONFIG_LOG_DEFAULT_LEVEL=ESP_LOG_NONE (Stage 3 / Row 2). |
| 21 | 1,464 | printBeforeSetupInfo() |
Arduino-ESP32 cores/esp32/chip-debug-report.cpp:292 |
Suppressed by FASTLED_SUPPRESS_ARDUINO_CHIP_DEBUG_REPORT=1 (Row 4 / #2894). |
| 23 | 1,177 | fl::Channel::resolveDynamicDriver() |
src/fl/channels/channel.cpp.hpp |
Gated by Row 8 / #2926; remaining bytes targetable in Stage 4. |
| 24 | 1,151 | fl::basic_string::write(const char*, fl::size) |
src/fl/stl/basic_string.cpp.hpp:193 |
Stage 5 simplification target. |
Sibling references
docs/SLIM_ESP32S3.md— live tracker. Update SLIM, not this issue, when a new row ships.- Meta: ESP32-S3 binary-size reduction — Batch 1 (~26 KB) + Batch 2 (~26–50 KB) (supersedes #2771) #2773 — predecessor (Batches 1+2). Closed.
- Meta: ESP32-S3 binary-size reduction — Batch 3 (successor to #2773) #2856 — successor architectural items (template-trait static dispatch, sstream→printf, etc.) that don't fit the flag-tier mould.
- Reduce per-symbol bloat in the FastLED 1-4KB function band on ESP32-S3 (logging must stay enabled) #2974 — ESP32-S3 1-4 KB bloat-band reduction (
#2974parent + bloat: mark fl::basic_string + fl::sstream dtors noexcept to eliminate per-call-site landing pads #2975–bloat: consolidate error log sites in ChannelEngineRMTImpl::reconfigureForNetwork + createChannel through expected<>::failure #2983 children). Complementary track. - [meta] WaveSimulation Q15 stencil — perf + algorithmic follow-ups from #3073 #3098 / audit(wave/diff-eq): overflow risk + perf wins in WaveSimulation Q15 stencil (behind WaveFx) #3073 — closed wave-PDE family (not bloat-related; mentioned because they share the same
bash bloat-based methodology).
Methodology (preserved from original)
PIO toolchain proved fragile (cache wipe during disk cleanup left compiler missing). For this round, audit via CI artifacts:
- Push a branch with the candidate change.
- Open a PR that triggers the existing
compile-manymatrix. - Extract
firmware.bin/firmware.mapfrom the CI artifact bundle. - Compare against a same-SHA baseline build (no change) on the same matrix entry.
FastLED/fbuild#417 would make step 3-4 push-button.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTriage
Activity
docs(review): encode FL_WARN/FL_ERROR default-visibility invariant
perf(log): default FASTLED_LOG_VERBOSITY=0 in release builds (#2886 S…
zackees commentedon Jun 7, 2026
Stage 1 — DONE ✅
Landed via PR #2890 (squash-merged at
0674ccdd8e).What shipped
src/fl/log/log.h— the unset default ofFASTLED_LOG_VERBOSITYnow resolves as:FASTLED_TESTINGsetNDEBUGset (release)Release builds (NDEBUG defined) collapse all
FL_WARN/FL_INFO/FL_ERROR/FL_PRINT/FL_DBGmacros todo {} while(0). Debug builds keep the full diagnostic stream.Guard-rails added in the same PR
To prevent regression of the developer-visibility contract ("FL_WARN/FL_ERROR remain active by default on NON-release builds"), the same PR adds matching enforcement to two review surfaces:
.claude/skills/code-review/review-rules.md→ new "FL_WARN / FL_ERROR DEFAULT-VISIBILITY INVARIANT" rule for the local code-review agent..coderabbit.yaml→ two newpath_instructionsentries coveringsrc/fl/log/**(verbosity contract) andsrc/**/*.{h,hpp,cpp,cpp.hpp,impl.hpp}(call-site wrapping audit).Measurement gate
The projected savings (~55 KB on ESP32-S3 NEOPIXEL Blink) get measured once
bash bloat esp32s3runs against a release build of master post-merge — that re-run belongs in Stage 6 (verification gate) or as a freestanding follow-up. The change itself is correct per the Stage 1 spec in this issue's body.Next
Stage 2: Arduino-ESP32 boot-banner suppression via
tools/suppress_arduino_chip_debug_report.cppshim (~3 KB).perf(esp32): suppress Arduino-ESP32 boot banner via build-flag shim (#…
docs(esp32): ship `tools/sdkconfig_for_smallest_fastled.defaults` ove…
docs(esp32): ship docs/SLIM_ESP32S3.md user-facing reference (#2886 S…
ci(esp32): bloat regression gate with ratcheting baseline (#2886 Stag…
docs(esp32): close out #2886 Stages 4 + 5 — audited / no action (#2902)
zackees commentedon Jun 7, 2026
Measured bloat audit — post-Stages-0+1+2+3+6, Stages 4+5 audited (2026-06-06)
Fresh
bash bloat esp32s3 --top 25onmaster @ 824cb5c0e3(PR #2902 just merged). Build viabash compile esp32s3 --examples Blink --platformio; release config;NDEBUGdefined → Stage 1'sFASTLED_LOG_VERBOSITY=0default fires.Important caveat: this build did NOT set
-DFASTLED_SUPPRESS_ARDUINO_CHIP_DEBUG_REPORT=1(Stage 2 build flag) and did NOT apply thetools/sdkconfig_for_smallest_fastled.defaultsoverlay (Stage 3). So the numbers below capture Stage 1's savings only — Stages 2 and 3 are still latent.Top-line
Top-25 deltas (pre-Stage-1 vs post-Stage-1)
fl::ClocklessIdf5<...>ctor (NEOPIXEL)fl::Channel::showPixelsfl::ChannelEngineRMTImpl::createChannelfl::ChannelEngineRMTImpl::reconfigureForNetworkfl::ChannelManager::addDriverfl::RmtMemoryManager::handleAllocateTxFailurefl::detail::Rmt5EncoderImpl::initializefl::Channel::resolveDynamicDriverThe six entries that fell off the top-25 entirely are exactly the Stage 4 audit targets that this issue's closing PR (#2902) marked "no action — already addressed by Stage 1." That's the measured confirmation of the audit finding.
What Stages 2 + 3 will recover (still latent)
These rows are still on the top-25 in the current measurement because the current build doesn't enable the relevant opt-in:
esp_core_dump_do_write_elf_passCONFIG_ESP_COREDUMP_ENABLE_TO_FLASH=ndiag_log_addCONFIG_LOG_DEFAULT_LEVEL=ESP_LOG_NONEprintBeforeSetupInfo()-DFASTLED_SUPPRESS_ARDUINO_CHIP_DEBUG_REPORT=1esp_core_dump_get_task_regs_dumpCONFIG_ESP_COREDUMP_ENABLE_TO_FLASH=nProjected fully-enabled build (Stages 1 + 2 + 3 all active):
That's a projected ≈ −48-50 KB / −12.5 % vs the pre-Stage-1 baseline once all three opt-ins are stacked.
Gap to #2886 end goal
The remaining ~60 KB lives in the structural items tracked by #2856 (Batch 3) —
Channel::showPixelstemplate-trait static dispatch (item 3.1, ~3-4 KB), printf-style log backend (item 3.2, ~5-10 KB),ChannelManagerstatic-bind path (item 3.3, ~5-10 KB), RMT5 encoder dedup (item 3.4, ~2-5 KB),fl::result<T,E>→ status code (item 3.5, ~1-2 KB, partly shipped inc8f21579), fixed-size allocation ledger (item 3.6, ~1 KB, shipped inef6e378e). Plus the newlib printf engine (#2-6 in the table above) accounting for ~42 KB that's IDF/newlib structural, not FastLED-side.Stages 4 + 5 audit verdict — confirmed by measurement
PR #2902 closed Stages 4 + 5 with "audited / no action because Stage 1 already collapsed the relevant byte attributions." The measured drop-off of every Stage 4 target from the top-25 (createChannel, reconfigureForNetwork, addDriver, handleAllocateTxFailure, Rmt5EncoderImpl::initialize, resolveDynamicDriver) is the empirical validation.
fl::basic_string::write(Stage 5 target) remains in the top-25 at 1,151 B unchanged — it's the COW + inline-vs-heap storage state machine, no formatted-stream machinery to drop. The Stage 5 projection (~0.5-1 KB) overestimated; the audit verdict stands.Stage 6 regression-gate baseline ratchet
The pinned baseline at
tests/data/esp32s3_bloat_baseline.txtis currently388380(the pre-Stage-1 number). Now that there's a measured post-Stage-1 number, the file should ratchet down to350568in a follow-up PR. That tightens the gate by ~38 KB — any PR that regresses past this point will fail CI.Doc flip 📊 → ✅
The
docs/SLIM_ESP32S3.mdpriority table currently marks every row 📊 (projected). After this measurement, rows 1 (FASTLED_LOG_VERBOSITY=0) and 3 (FASTLED_RMT_STATIC_ALLOCATION) can flip to ✅ with the measured numbers attached. Stage 2 and Stage 3 stay 📊 until a build with their flags enabled is also measured. A follow-up PR will land both flips together.Artifacts
report.json,report.md:.build/symbols/esp32s3/against ELF SHA-matched tomaster @ 824cb5c0e3.xtensa-esp32s3-elf-nmfrom~/.platformio/packages/toolchain-xtensa-esp-elf/bin/.FASTLED_LOG_VERBOSITYdefaults to 0 per perf(log): default FASTLED_LOG_VERBOSITY=0 in release builds (#2886 Stage 1) #2890).🤖 Generated with Claude Code
chore(bloat): ratchet baseline 388380 -> 350568 + flip Stage 1 row to…
tools(bloat): ship tests/measure_esp32s3_opt_ins.py multi-config audi…
perf(esp32): add fl::sort_small for bounded containers; cut Clockless…
chore(bloat): ratchet baseline 350568 -> 350127 (post-#2908 fl::sort_…
38 remaining items
feat(log): centralised log_emit helper (Proposal B Option 3 of #2963) (…
zackees commentedon Jun 16, 2026
Triage pass:
Progress so far (per merged PRs #2900, #2906, #2936, #2949, #2959 all on 2026-06-07):
Target was 280,000 B (-28%); we're at 338 KB so ~58 KB still to find.
Stages 2-5 (Arduino-ESP32 boot banner suppress / sdkconfig defaults / cold-helper audit / basic_string::write) project a combined ~14-20 KB on paper — even if all four ship, we'd still miss target by ~38 KB.
Branch
feat/esp32s3-bloat-reduction(last commit f013443) hasn't moved since 2026-06-07. The meta itself has been silent for the same period.Three options:
No off-bench action from me without an explicit pick. Standing by.
zackees commentedon Jun 16, 2026
Update to my prior triage — I missed substantial shipped work:
Cross-checking against
docs/SLIM_ESP32S3.mdshows the project has actually shipped 7 of 9 flag-tier interventions documented there (#2890 / #2894 / #2896 / #2915 / #2920 / #2926 / #2931), plus the Stage 6 CI gate (#2900) and Stage 0 docs (#2906 / #2936 / #2949 / #2959). The body's "Stage 2" was already shipped in #2894 — fixed the body to reflect this.Effective progress:
Remaining stages in the body that map to unstarted SLIM rows:
Updated recommendation: the gap between meta body language and the SLIM doc reality means the meta has been doing its job in chunks the body didn't track. Three options:
Option 1 is the cleanest documentation outcome; option 3 is the cleanest execution outcome. I retract my prior "stale-ish" framing — work continued in the SLIM doc but stopped updating this meta.
zackees commentedon Jun 16, 2026
Meta body rewritten to mirror
docs/SLIM_ESP32S3.mdas the live tracker (A5 of meta #3122). 7 of 9 flag-tier interventions show as shipped (#2846, #2890, #2894, #2896, #2915, #2920, #2926, #2931); two remain projection-only (Row 4 #2894 measured but not bytes-verified, Row 5 BT-disable not picked up); plus Stage 4 (cold-helper audit) and Stage 5 (basic_string::write) as code-change tracks separate from the flag tier.SLIM_ESP32S3.md is now the single source of truth. Update SLIM, not this issue, when a new row ships.
perf(string): consolidate basic_string::write overloads (refs #3122 B…
zackees commentedon Aug 20, 2026
Triaged against current master ad40fd2.
Marking deferred: this is a multi-phase meta tracker. Much of Stages 1-3 shipped, but the strict target is not proven and the remaining work spans measurements plus several structural child issues.
Current evidence:
Restart after restoring the red gate and generating a fresh current-toolchain opt-in matrix that defines whether 280 KB applies to default or max-opt-in configuration. Split any remaining execution into bounded children rather than continuing in this meta.
perf(channels): let the linker drop the colour pipeline when nothing …
perf(channels): let the linker drop the colour pipeline when nothing …
perf(channels): let the linker drop the colour pipeline when nothing …
ci: ratchet the ESP32-S3 baseline down to what master now measures (#…
fix(ci): settle the bloat ratchet, and make it notice its own slack (#…
perf(channels): let the linker drop the colour pipeline when nothing …
feat(channels): run the colour pipeline in show() (P6, #4040) (#4200)
fix(esp32): keep unused Serial0 out of stock Arduino-ESP32 images (#4892