Skip to content

Ship tests/measure_esp32s3_opt_ins.py multi-config bloat audit driver (#2886) #2905

Closed

Description

@zackees

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:

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:

  1. The exact build configs (which build_flags and board_build.sdkconfig_defaults for each combo).
  2. The measurement protocol (bash compile esp32s3 --examples Blink --platformio then bash bloat esp32s3).
  3. 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:

  1. Backs up platformio.ini (so a Ctrl-C mid-run leaves the user's file intact).
  2. For each requested config in turn:
    • Rewrites platformio.ini's [env:esp32s3] section with the opt-in's build_flags and board_build.sdkconfig_defaults lines.
    • Runs bash compile esp32s3 --examples Blink --platformio.
    • Runs bash bloat esp32s3 (no --build; the ELF is fresh).
    • Captures total_flash from .build/symbols/esp32s3/report.json.
    • Copies report.json to .build/symbols/esp32s3/report.<config>.json so each config's data is preserved.
  3. Restores platformio.ini from the backup.
  4. Prints a Markdown comparison table with one row per config: name, total_flash, Δ vs. baseline, Δ vs. previous config.
  5. If --out <path> set, writes the table to that path so a SLIM doc PR can cat it 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

  1. tests/measure_esp32s3_opt_ins.py exists and runs end-to-end via uv run python tests/measure_esp32s3_opt_ins.py --config baseline.
  2. The script handles a Ctrl-C / build-failure mid-run by restoring platformio.ini from its backup.
  3. --config all produces a Markdown comparison table with one row per (baseline, stage2, stage3, stage4, stack).
  4. agents/docs/binary-size-analysis.md has a one-line pointer to the script.
  5. 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.txt further — the gate baseline only tightens when a measured saving lands in src/, 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

🤖 Generated with Claude Code

Activity

  1. moved this from Triage to Done in FastLED Trackeron Jun 7, 2026
  2. added a commit that references this issue on Jun 7, 2026
    b703899
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