Skip to content

Add a minimal-size cargo build profile for users who want to build a smaller binary#21826

Merged
Gankra merged 1 commit intoastral-sh:mainfrom
lmmx:minimal-size-profile
Dec 6, 2025
Merged

Add a minimal-size cargo build profile for users who want to build a smaller binary#21826
Gankra merged 1 commit intoastral-sh:mainfrom
lmmx:minimal-size-profile

Conversation

@lmmx
Copy link
Contributor

@lmmx lmmx commented Dec 6, 2025

This PR adds the same minimal-size profile as uv repo workspace has

# Profile to build a minimally sized binary for uv-build
[profile.minimal-size]
inherits = "release"
opt-level = "z"
# This will still show a panic message, we only skip the unwind
panic = "abort"
codegen-units = 1

but removes its panic = "abort" setting

Compared to the ones pre-built via uv tool install, this builds 35% smaller ruff and 24% smaller ty binaries
(as measured here)

@lmmx lmmx changed the title perf: add minimal-size profile (same as in uv) perf: add minimal-size profile Dec 6, 2025
Copy link
Contributor

@Gankra Gankra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No harm in including this, and convenient to be able to point people to if they complain about size.

@astral-sh-bot
Copy link

astral-sh-bot bot commented Dec 6, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@Gankra Gankra merged commit 6e0e49e into astral-sh:main Dec 6, 2025
38 checks passed
@Gankra Gankra changed the title perf: add minimal-size profile Add a minimal-size cargo build profile for users who want to build a smaller binary Dec 6, 2025
@Gankra Gankra added ty Multi-file analysis & type inference release Related to the release process labels Dec 6, 2025
@lmmx lmmx deleted the minimal-size-profile branch December 6, 2025 19:57
dcreager added a commit that referenced this pull request Dec 7, 2025
* origin/main:
  [ty] Add test case for fixed panic (#21832)
  [ty] Avoid double-analyzing tuple in `Final` subscript (#21828)
  [flake8-bandit] Fix false positive when using non-standard `CSafeLoader` path (S506). (#21830)
  Add minimal-size build profile (#21826)
dcreager added a commit that referenced this pull request Dec 7, 2025
* origin/main:
  [ty] Add test case for fixed panic (#21832)
  [ty] Avoid double-analyzing tuple in `Final` subscript (#21828)
  [flake8-bandit] Fix false positive when using non-standard `CSafeLoader` path (S506). (#21830)
  Add minimal-size build profile (#21826)
  [ty] Allow `tuple[Any, ...]` to assign to `tuple[int, *tuple[int, ...]]` (#21803)
  [ty] Support renaming import aliases (#21792)
  [ty] Add redeclaration LSP tests (#21812)
  [ty] more detailed description of "Size limit on unions of literals" in mdtest (#21804)
  [ty] Complete support for `ParamSpec` (#21445)
  [ty] Update benchmark dependencies (#21815)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release Related to the release process ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants