Repository navigation
Description
Goal
Ship tests/measure_esp32s3_opt_ins.py — a CLI driver that builds the ESP32-S3 NEOPIXEL Blink under each release-mode opt-in combo from #2886, runs bash bloat esp32s3 against each ELF, and emits a single comparison table. Output is the empirical input that flips rows 2, 3, 4 of docs/SLIM_ESP32S3.md from 📊 → ✅.
No FastLED-runtime source change. This PR ships measurement infrastructure only; the actual rows-flip PRs come in follow-up iterations that consume the script's output.
Parent: #2886 — follow-up to the audit comment (#2886#issuecomment-4641413123) and the ratchet PR (#2904).
Why a script, not a one-shot measurement
The four opt-ins from the SLIM doc priority table are:
- Row 1 (
FASTLED_LOG_VERBOSITY=0) — ✅ measured via chore(bloat): ratchet baseline 388380 -> 350568 + flip Stage 1 row to ✅ measured #2904; default on release builds. - Row 2 (
tools/sdkconfig_for_smallest_fastled.defaultsoverlay) — 📊. - Row 3 (
-DFASTLED_RMT_STATIC_ALLOCATION=1) — 📊. - Row 4 (
-DFASTLED_SUPPRESS_ARDUINO_CHIP_DEBUG_REPORT=1) — 📊.
Each opt-in requires a separate build with different platformio.ini settings. Running them by hand each time someone wants to refresh the doc is error-prone and bit-rots. The script encodes:
- The exact build configs (which
build_flagsandboard_build.sdkconfig_defaultsfor each combo). - The measurement protocol (
bash compile esp32s3 --examples Blink --platformiothenbash bloat esp32s3). - The output format (a comparison table that maps 1:1 onto the SLIM priority table rows).
Future iterations re-run the script after any code change that might affect the savings; the doc gets updated from the script's output.
Deliverable
tests/measure_esp32s3_opt_ins.py
CLI shape:
uv run python tests/measure_esp32s3_opt_ins.py [--config baseline|stage2|stage3|stage4|all]
[--example Blink]
[--out comparison.md]
[--keep-platformio-ini-backup]
Behavior:
- Backs up
platformio.ini(so a Ctrl-C mid-run leaves the user's file intact). - For each requested config in turn:
- Rewrites
platformio.ini's[env:esp32s3]section with the opt-in'sbuild_flagsandboard_build.sdkconfig_defaultslines. - Runs
bash compile esp32s3 --examples Blink --platformio. - Runs
bash bloat esp32s3(no--build; the ELF is fresh). - Captures
total_flashfrom.build/symbols/esp32s3/report.json. - Copies
report.jsonto.build/symbols/esp32s3/report.<config>.jsonso each config's data is preserved.
- Rewrites
- Restores
platformio.inifrom the backup. - Prints a Markdown comparison table with one row per config: name, total_flash, Δ vs. baseline, Δ vs. previous config.
- If
--out <path>set, writes the table to that path so a SLIM doc PR cancatit inline.
Config matrix
| Config name | build_flags addition | sdkconfig overlay | Source row |
|---|---|---|---|
baseline |
(none) | (user default) | row 1 (Stage 1 — NDEBUG default) |
stage2 |
-DFASTLED_SUPPRESS_ARDUINO_CHIP_DEBUG_REPORT=1 |
(user default) | row 4 |
stage3 |
(none) | + tools/sdkconfig_for_smallest_fastled.defaults |
row 2 |
stage4 |
-DFASTLED_RMT_STATIC_ALLOCATION=1 |
(user default) | row 3 |
stack |
rows 2 + 3 + 4 all enabled | overlay applied | "TL;DR" combo from SLIM doc |
The stack config measures the realistic end-state for a user who follows the SLIM TL;DR snippet verbatim — that's the number the #2886 end-goal gap of ~60 KB to 280,000 B is computed against.
Doc pointer
agents/docs/binary-size-analysis.md gets a one-line pointer to the script under the existing "Release-build flash savers" table so users / agents know how to refresh the measurements.
Acceptance
tests/measure_esp32s3_opt_ins.pyexists and runs end-to-end viauv run python tests/measure_esp32s3_opt_ins.py --config baseline.- The script handles a Ctrl-C / build-failure mid-run by restoring
platformio.inifrom its backup. --config allproduces a Markdown comparison table with one row per (baseline, stage2, stage3, stage4, stack).agents/docs/binary-size-analysis.mdhas a one-line pointer to the script.- No change to FastLED runtime sources, examples, or
tests/data/esp32s3_bloat_baseline.txt.
Out of scope
- Running the measurements and updating the SLIM doc rows. That's the follow-up PR after this one — it
cats the script's table into the doc and flips 📊 → ✅ for rows backed by the measurement. - Ratcheting
tests/data/esp32s3_bloat_baseline.txtfurther — the gate baseline only tightens when a measured saving lands insrc/, not when a user-side build flag delivers the savings. - CI integration of the script. Initial scope is a developer-facing local tool; CI-side measurement is a separate Stage-7-style follow-up.
Related
- Meta: ESP32-S3 Blink bloat reduction (file:line concrete plan) — supersedes #2885 #2886 — parent meta tracking the multi-stage bloat reduction.
- chore(bloat): ratchet baseline 388380 -> 350568 + flip Stage 1 row to ✅ measured #2904 — ratchet PR (the immediate predecessor that flipped row 1).
- ci(esp32): bloat regression gate with ratcheting baseline (#2886 Stage 6) #2900 — Stage 6 gate (uses the same
bash bloat esp32s3pipeline this script drives). - Audit comment: FastLED#2886 (comment).
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
tools(bloat): ship tests/measure_esp32s3_opt_ins.py multi-config audi…