Skip to content

tools(bloat): extend measure_esp32s3_opt_ins.py with 4 new opt-ins + max_savings - #2934

Merged
zackees merged 1 commit into
masterfrom
feat/2933-extend-measure-driver
Jun 7, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/2933-extend-measure-driver

Conversation

@zackees

@zackees zackees commented Jun 7, 2026 •

Copy link
Copy Markdown
Member

Closes #2933. Extends the measurement driver with the 4 opt-in gates shipped after #2906 (SPI, UCS7604, dyndriver, events) + a max_savings stack config. Output table gains a SLIM row column so it maps 1:1 onto the priority table. Refs #2886.

Summary by CodeRabbit

  • New Features
    • Expanded build configuration measurement to include additional configuration gates and a new maximum-savings option.
    • Enhanced configuration comparison documentation with improved table formatting.

…max_savings

Closes #2933.

Adds coverage for the four opt-in build flags shipped after #2906:

- `FASTLED_DISABLE_SPI_CHIPSETS=1` (#2914) — disable_spi config
- `FASTLED_DISABLE_UCS7604=1` (#2921) — disable_ucs7604 config
- `FASTLED_DISABLE_DYNAMIC_DRIVER=1` (#2927) — disable_dyndriver config
- `FASTLED_DISABLE_CHANNEL_EVENTS=1` (#2932) — disable_events config

Plus a new `max_savings` config that stacks ALL eight opt-ins
(Stages 2 + 3 + 4 + the 4 new gates) — the headline cumulative
saving for users who enable everything.

Also adds a `slim_row` field to `OptInConfig` and a new `SLIM row`
column to the comparison table. The output table now maps 1:1 onto
the priority table in `docs/SLIM_ESP32S3.md`, making it
copy-pasteable into a follow-up doc-flip PR.

## Files

- `tests/measure_esp32s3_opt_ins.py`:
  - `OptInConfig` gains `slim_row: int | None`.
  - New module-level `_ALL_OPT_IN_FLAGS` tuple so the `max_savings`
    config doesn't drift from the per-flag configs.
  - 4 new configs + `max_savings` added to `CONFIGS`.
  - `format_table` gains the `SLIM row` column.

## Verification

- `bash lint` -> all linters pass (ruff, ty, C++, JS setup).
- No FastLED runtime change; doesn't affect any build.
- The config matrix matches the SLIM doc priority table 1:1.

## Out of scope

- Running the measurements. Separate follow-up PR.
- Updating SLIM doc rows 📊 → ✅. Requires the measurements.

Refs #2886, #2906, #2914, #2921, #2927, #2932.
@zackees
zackees merged commit f43f767 into master Jun 7, 2026
@coderabbitai

coderabbitai Bot commented Jun 7, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 19fd61f2-d2f6-4660-982e-ba248a73f8b2

📥 Commits

Reviewing files that changed from the base of the PR and between 9dd82cf and 3d6903b.

📒 Files selected for processing (1)
  • tests/measure_esp32s3_opt_ins.py

📝 Walkthrough

Walkthrough

The measurement script tests/measure_esp32s3_opt_ins.py is extended with a slim_row field in the OptInConfig dataclass to map each build configuration to rows in the SLIM documentation, and the configuration set expands to include four new opt-in build flag gates and a max_savings stacked configuration with SLIM row mappings. Table formatting is updated to display the new SLIM row column.

Changes

SLIM measurement configuration and table

Layer / File(s) Summary
OptInConfig model and configuration definitions
tests/measure_esp32s3_opt_ins.py
OptInConfig dataclass extended with slim_row: int | None = None field. Configuration set expanded from 5 baseline/stage configs to 9, including four new individual opt-in gates (disable_spi, disable_ucs7604, disable_dyndriver, disable_events) and max_savings stacked config, each with corresponding SLIM row number, build flags, labels, and overlay settings.
Table formatting with SLIM row column
tests/measure_esp32s3_opt_ins.py
Markdown table header row updated to include SLIM row column. Per-config row generation now renders cfg.slim_row (or em-dash when absent) into the new column, with format string adjusted to match updated column schema.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • #2933: Directly addresses the goal of extending tests/measure_esp32s3_opt_ins.py with the four new opt-in build flag configs and max_savings stack, plus adding SLIM row column to the comparison table output.
  • #2905: Shares the same file changes and OptInConfig/table generation modifications.
  • #2903: Relates to docs/SLIM_ESP32S3.md table updates that this script's slim_row field directly maps to.

Possibly related PRs

  • FastLED/FastLED#2906: Introduced the original tests/measure_esp32s3_opt_ins.py measurement driver and format_table function; this PR extends that foundation with the slim_row field and new configuration gates.
  • FastLED/FastLED#2904: Updates docs/SLIM_ESP32S3.md table structure and values; this PR's slim_row mappings directly support that documentation.
  • FastLED/FastLED#2898: Introduces the user-facing SLIM ESP32-S3 documentation that this script's slim_row column now maps to.

Poem

🐰 A row of configs, mapped to the doc,
Each slim_row marked with metronomic clock.
Four gates and a max, all stacked with care,
The table now shows where measurements share! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/2933-extend-measure-driver

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@fastled-project-sync fastled-project-sync Bot moved this from Done to Triage in FastLED Tracker Jun 7, 2026
zackees added a commit that referenced this pull request Jun 7, 2026
When running on Windows via `uv run python tests/measure_esp32s3_opt_ins.py`,
the previous `subprocess.run(["bash", "compile", ...])` failed with:

    WSL ERROR: CreateProcessCommon:818: execvpe(/bin/bash) failed:
    No such file or directory

`bash` is not on PATH in a non-WSL Windows Python (the WSL relay-only
bash on the default PATH does not provide `/bin/bash`). The project
ships a `compile.bat` Windows wrapper for the same reason
`ci/bloat.py` uses it. Mirror that pattern.

For `bash bloat`, there is no `bloat.bat` shim — the bash wrapper is
a one-line `uv run ci/bloat.py "$@"`, so we invoke the Python entry
point directly on Windows.

Both branches use absolute paths via `PROJECT_ROOT` because Windows
`subprocess.run` does not auto-resolve `.bat` files relative to the
`cwd` argument.

## Files

- tests/measure_esp32s3_opt_ins.py:
  - New `_run_compile_cmd(example)` helper picks bash compile (Linux)
    or absolute-path compile.bat (Windows).
  - New `_run_bloat_cmd()` helper picks bash bloat (Linux) or
    `uv run ci/bloat.py` (Windows).
  - `run_compile` / `run_bloat` use the helpers.

## Verification

- `uv run python tests/measure_esp32s3_opt_ins.py --config baseline`
  on Windows: succeeded; produced `total_flash = 339,962 B` (matches
  the current pinned baseline).
- bash lint -> all linters pass.

Refs #2886, #2935, #2906, #2934.
zackees added a commit that referenced this pull request Jun 7, 2026
…) (#2937)

Closes #2935 (partial — 4 configs failed silently during the
measurement; the 6 successful configs flip the rows below).

Ran `tests/measure_esp32s3_opt_ins.py --config all` end-to-end against
`master @ f43f767`. The script's comparison table:

| Config | SLIM row | total_flash | Δ vs baseline |
|---|:---:|---:|---:|
| baseline | 1 | 339,962 B | +0 B |
| stage3 (sdkconfig overlay) | 2 | **280,738 B** | **−59,224 B** |
| stage4 (FASTLED_RMT_STATIC_ALLOCATION) | 3 | 339,054 B | −908 B |
| disable_ucs7604 | 7 | 336,158 B | **−3,804 B** |
| disable_dyndriver | 8 | 339,025 B | −937 B |
| disable_events | 9 | 331,928 B | **−8,034 B** |

## Headlines

- **Stage 3 alone hits the #2886 end-goal.** The
  `tools/sdkconfig_for_smallest_fastled.defaults` overlay drops
  total_flash to 280,738 B — within 738 B of the 280,000 B target.
  Adding `CONFIG_NEWLIB_NANO_FORMAT=y` to the overlay in #2916 was
  the dominant lever (~30-45 KB of the saving).
- **Three opt-in flags vastly exceeded projection** — `disable_events`
  delivered 4-8× projection (−8,034 B vs ~1-2 KB), `disable_ucs7604`
  delivered 6-9× (−3,804 B vs ~400-600 B). The dead-strip cascade
  pattern (see #2918 / #2925 / #2929 precedents) consistently
  delivers above projection when collapsing template-heavy machinery.

## What flipped 📊 → ✅

- Row 2 (overlay): −59,224 B measured. **Hits end-goal.**
- Row 3 (FASTLED_RMT_STATIC_ALLOCATION): −908 B measured (well
  below projection — the static-allocation path is mostly
  already-optimal post-Stage-1).
- Row 7 (FASTLED_DISABLE_UCS7604): −3,804 B measured.
- Row 8 (FASTLED_DISABLE_DYNAMIC_DRIVER): −937 B measured.
- Row 9 (FASTLED_DISABLE_CHANNEL_EVENTS): −8,034 B measured.

## What's still 📊

- Row 4 (FASTLED_SUPPRESS_ARDUINO_CHIP_DEBUG_REPORT): the config
  failed silently during the measurement run — see follow-up.
- Row 5 (CONFIG_BT_ENABLED=n): no opt-in path in the current overlay
  (it's commented out per the user-side opt-in design).
- Row 6 (FASTLED_DISABLE_SPI_CHIPSETS): also failed silently.

The 4 missing configs (`stage2`, `stack`, `disable_spi`,
`max_savings`) need a separate troubleshooting pass. The output
redirection in the original measurement command discarded the
per-build error messages so the failure cause isn't visible. A
follow-up issue will rerun those with full output capture.

## Files

- docs/SLIM_ESP32S3.md:
  - Baseline table updated with the new measured default-flag number
    (339,962 B) and a callout that Stage 3 alone hits the end-goal.
  - Rows 2 / 3 / 7 / 8 / 9 flip 📊 → ✅ with measured deltas inline.

## Verification

- bash lint --cpp -> all C++ linting checks pass.
- The measured numbers in the doc are word-for-word the script's
  table output.

Refs #2886, #2935, #2906, #2934, #2916.
zackees added a commit that referenced this pull request Jun 7, 2026
….py (#2939)

* docs(esp32): flip SLIM rows 2/3/7/8/9 to ✅ with measured numbers (#2935)

Closes #2935 (partial — 4 configs failed silently during the
measurement; the 6 successful configs flip the rows below).

Ran `tests/measure_esp32s3_opt_ins.py --config all` end-to-end against
`master @ f43f767`. The script's comparison table:

| Config | SLIM row | total_flash | Δ vs baseline |
|---|:---:|---:|---:|
| baseline | 1 | 339,962 B | +0 B |
| stage3 (sdkconfig overlay) | 2 | **280,738 B** | **−59,224 B** |
| stage4 (FASTLED_RMT_STATIC_ALLOCATION) | 3 | 339,054 B | −908 B |
| disable_ucs7604 | 7 | 336,158 B | **−3,804 B** |
| disable_dyndriver | 8 | 339,025 B | −937 B |
| disable_events | 9 | 331,928 B | **−8,034 B** |

## Headlines

- **Stage 3 alone hits the #2886 end-goal.** The
  `tools/sdkconfig_for_smallest_fastled.defaults` overlay drops
  total_flash to 280,738 B — within 738 B of the 280,000 B target.
  Adding `CONFIG_NEWLIB_NANO_FORMAT=y` to the overlay in #2916 was
  the dominant lever (~30-45 KB of the saving).
- **Three opt-in flags vastly exceeded projection** — `disable_events`
  delivered 4-8× projection (−8,034 B vs ~1-2 KB), `disable_ucs7604`
  delivered 6-9× (−3,804 B vs ~400-600 B). The dead-strip cascade
  pattern (see #2918 / #2925 / #2929 precedents) consistently
  delivers above projection when collapsing template-heavy machinery.

## What flipped 📊 → ✅

- Row 2 (overlay): −59,224 B measured. **Hits end-goal.**
- Row 3 (FASTLED_RMT_STATIC_ALLOCATION): −908 B measured (well
  below projection — the static-allocation path is mostly
  already-optimal post-Stage-1).
- Row 7 (FASTLED_DISABLE_UCS7604): −3,804 B measured.
- Row 8 (FASTLED_DISABLE_DYNAMIC_DRIVER): −937 B measured.
- Row 9 (FASTLED_DISABLE_CHANNEL_EVENTS): −8,034 B measured.

## What's still 📊

- Row 4 (FASTLED_SUPPRESS_ARDUINO_CHIP_DEBUG_REPORT): the config
  failed silently during the measurement run — see follow-up.
- Row 5 (CONFIG_BT_ENABLED=n): no opt-in path in the current overlay
  (it's commented out per the user-side opt-in design).
- Row 6 (FASTLED_DISABLE_SPI_CHIPSETS): also failed silently.

The 4 missing configs (`stage2`, `stack`, `disable_spi`,
`max_savings`) need a separate troubleshooting pass. The output
redirection in the original measurement command discarded the
per-build error messages so the failure cause isn't visible. A
follow-up issue will rerun those with full output capture.

## Files

- docs/SLIM_ESP32S3.md:
  - Baseline table updated with the new measured default-flag number
    (339,962 B) and a callout that Stage 3 alone hits the end-goal.
  - Rows 2 / 3 / 7 / 8 / 9 flip 📊 → ✅ with measured deltas inline.

## Verification

- bash lint --cpp -> all C++ linting checks pass.
- The measured numbers in the doc are word-for-word the script's
  table output.

Refs #2886, #2935, #2906, #2934, #2916.

* feat(bloat): capture per-config build logs in measure_esp32s3_opt_ins.py

Closes #2938 (partial — script side).

Pre-#2938 the script ran `bash compile` / `bash bloat` for each config
and discarded the per-build stdout/stderr. When a config crashed
(see #2935 — 4 of 10 configs crashed on Windows with `extras+.cpp.o`
exit 3221225794), the failure cause was invisible. Without that
information, debugging required manual single-config reruns.

This PR routes every config's compile and bloat output through a
new `_run_with_log()` helper that writes to `.build/measure-logs/
<config>-{compile,bloat}.log` while tee'ing the same stream to the
operator's terminal. On any future crash the log file is the
diagnosable artifact.

## Files

- tests/measure_esp32s3_opt_ins.py:
  - New `_LOG_DIR` constant (`.build/measure-logs`).
  - New `_run_with_log(cmd, log_name)` helper that does combined
    stdout+stderr capture via subprocess.Popen + chunked read.
  - `run_compile` and `run_bloat` take a `config_name` parameter and
    delegate to `_run_with_log`.
  - `measure_one` passes `cfg.name` to both.

## Verification

- bash lint -> all linters pass (ruff, ty, C++, JS setup).
- Smoke test (`--config baseline`) produces a log file pair at
  `.build/measure-logs/baseline-compile.log` and
  `.build/measure-logs/baseline-bloat.log`.

## Known follow-up

The smoke test surfaced a separate issue: when consecutive runs use
the same build_flags + sdkconfig, PIO returns a cached ELF from a
prior run (potentially with different config). This is a build-cache
hygiene problem orthogonal to the log capture. To be addressed in a
future PR — possibly via `bash compile --clean` between configs or
an explicit invalidation of `.build/pio/esp32s3/.pio/build/`.

Refs #2886, #2938, #2935, #2906.
@zackees
zackees deleted the feat/2933-extend-measure-driver branch August 21, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

Extend tests/measure_esp32s3_opt_ins.py with 4 new opt-in configs + max_savings (#2886)

1 participant