Skip to content

default source installs to fast no-LTO profile - #1086

Merged
zackees merged 1 commit into
mainfrom
agent/no-lto-pip-gc-sections
Jul 16, 2026
Merged

default source installs to fast no-LTO profile#1086
zackees merged 1 commit into
mainfrom
agent/no-lto-pip-gc-sections

Conversation

@zackees

@zackees zackees commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

  • Keep source installs on the fast Rust dev profile (no LTO) by default.
  • Add the supported PEP 517 override: pip install . --config-settings fbuild-profile=release.
  • Preserve FBUILD_BUILD_RELEASE=1 as an environment override.
  • Guarantee ESP32 linker section garbage collection even when SDK linker flags replace the JSON fallback.
  • Document the profile behavior and include the backend adapter in source distributions.

Why

pip install . -- --release is not a supported pip-to-PEP-517 forwarding mechanism. The backend adapter translates the standard --config-settings value into the existing setup.py profile switch.

No-LTO builds already compile with -ffunction-sections and -fdata-sections across the platform JSON configurations. The ESP32 linker now adds -Wl,--gc-sections when SDK-provided linker flags omit it, preserving section-level dead-code elimination for compact quick builds.

Measurements

Using tests/platform/esp32dev, ESP32 Arduino core 3.3.7, and xtensa-esp-elf-gcc 14.2.0:

Profile Clean build Flash RAM
Quick / no LTO 17.5s 295,244 bytes 100,521 bytes
Release / full LTO 20.2s 295,244 bytes 100,521 bytes

For this fixture, no-LTO is 2.7 seconds (13%) faster with no measured size penalty after section garbage collection. The result is fixture-specific; broader boards should be benchmarked separately.

Validation

  • uv build --wheel --no-build-isolation: passed; produced dist/fbuild-2.5.2-cp313-cp313-win_amd64.whl.
  • PEP 517 profile translation and setuptools metadata hook: passed.
  • soldr rustfmt --check crates/fbuild-build-esp/src/esp32/esp32_linker.rs: passed.
  • Static audit: all platform JSON configurations contain function/data section splitting and --gc-sections.
  • git diff --check: passed.

The wheel’s first native build took about 12.1 minutes because the Cargo target was cold; subsequent installs reuse the pinned incremental target.

Summary by CodeRabbit

  • New Features

    • Added support for selecting fast development or optimized release builds through standard package installation settings.
    • Source distributions now include the required build support for these installation options.
  • Bug Fixes

    • Ensured section garbage collection is enabled when using SDK-provided linker flags, reducing unnecessary firmware content.
  • Documentation

    • Clarified installation commands, release-build configuration, and unsupported argument-passing behavior.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8601d091-1a0e-46a7-88fe-2445b144e620

📥 Commits

Reviewing files that changed from the base of the PR and between debc996 and 0824754.

📒 Files selected for processing (6)
  • MANIFEST.in
  • build_backend.py
  • crates/fbuild-build-esp/src/esp32/esp32_linker.rs
  • docs/getting-started/README.md
  • pyproject.toml
  • setup.py

📝 Walkthrough

Walkthrough

Adds a PEP 517 backend adapter supporting fbuild profile settings, configures packaging to use it, documents release builds, and preserves ESP32 linker section garbage collection when SDK flags are provided.

Changes

PEP 517 build backend

Layer / File(s) Summary
Profile-aware backend adapter
build_backend.py
Normalizes and validates fbuild-profile and fbuild-release, temporarily sets FBUILD_BUILD_RELEASE, and delegates wheel, editable, sdist, metadata, and requirement operations to setuptools.
Backend wiring and release documentation
pyproject.toml, MANIFEST.in, setup.py, docs/getting-started/README.md
Selects the custom backend, packages it, documents the supported release setting, and describes the corresponding build behavior.

ESP32 linker flags

Layer / File(s) Summary
Preserve section garbage collection
crates/fbuild-build-esp/src/esp32/esp32_linker.rs
Ensures -Wl,--gc-sections is present when SDK linker flags are used and tests that path.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Pip
  participant build_backend
  participant Setuptools
  participant setup_py
  Pip->>build_backend: Pass fbuild profile settings
  build_backend->>build_backend: Validate settings
  build_backend->>setup_py: Set FBUILD_BUILD_RELEASE temporarily
  build_backend->>Setuptools: Delegate build operation
  Setuptools-->>Pip: Return artifact or metadata
Loading
✨ 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 agent/no-lto-pip-gc-sections

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.

@zackees
zackees marked this pull request as ready for review July 16, 2026 08:49
@zackees
zackees merged commit 2a6edef into main Jul 16, 2026
8 of 14 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jul 17, 2026
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.

1 participant