Skip to content

Use ICF in macOS release builds to reduce binary sizes#19615

Merged
zanieb merged 10 commits into
mainfrom
zb/icf
Jun 9, 2026
Merged

Use ICF in macOS release builds to reduce binary sizes#19615
zanieb merged 10 commits into
mainfrom
zb/icf

Conversation

@zanieb

@zanieb zanieb commented May 29, 2026

Copy link
Copy Markdown
Member

Inspired by denoland/deno#34478

Use --icf=safe for optimized macOS release artifacts, via Rust's bundled Mach-O LLD.

Measurements showed useful size wins on macOS; Linux did not show a meaningful artifact-size improvement and are excluded here. See #19615 (comment)

Comment thread .github/workflows/build-release-binaries.yml Outdated
Comment thread .github/workflows/build-release-binaries.yml Outdated
Comment thread .github/workflows/build-release-binaries.yml Outdated
@astral-sh-bot

astral-sh-bot Bot commented May 29, 2026

Copy link
Copy Markdown

uv test inventory changes

This PR no longer changes the tests when compared with the latest main baseline.

@zanieb

zanieb commented May 30, 2026

Copy link
Copy Markdown
Member Author

Hm...

Screenshot 2026-05-30 at 12 17 13 AM

@zsol

zsol commented May 30, 2026

Copy link
Copy Markdown
Member

Hmm, how does that change if we do more aggressive ICF? FWIW I'm not entirely sure this amount of wins is worth the (slight) risk of confusing crash reports/coredumps. OTOH this decision is easy to reverse

@zanieb

zanieb commented May 30, 2026

Copy link
Copy Markdown
Member Author

I can't tell if this is actually working as intended — I'm going to poke at it more.

@zanieb zanieb force-pushed the zb/icf branch 12 times, most recently from 63aa9b2 to 0984566 Compare June 1, 2026 20:45
@zanieb zanieb changed the base branch from zb/use-mold-in-release-builds to main June 1, 2026 21:26
@zaniebot

zaniebot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Measurement data

Moved out of the PR body to keep the summary short.

Observed timings

These are GitHub Actions elapsed job times, not isolated linker benchmarks. The no-ICF cohort uses retained ordinary release builds (1, 2, 3); the ICF cohort uses this PR's first run and rerun. Treat the deltas as directional CI observations: the aarch64 baseline range in particular contains a noisy outlier.

Target No ICF avg (n=3) No ICF range ICF avg (n=2) ICF range Delta
x86_64-apple-darwin 7:33 7:22-7:49 7:18 7:16-7:20 -3.3%
aarch64-apple-darwin 8:23 7:17-10:30 7:05 6:56-7:13 -15.5%
x86_64-unknown-linux-gnu 12:03 10:59-12:41 11:36 10:36-12:35 -3.7%

A same-source no-ICF control run toggled only the ICF flags off. Its single elapsed-time sample is slower than the retained cohort, which reinforces that the job-level timings are too noisy to isolate a small linker change:

Target Same-source no ICF control (n=1) ICF avg (n=2) ICF range
x86_64-apple-darwin 10:20 7:18 7:16-7:20
aarch64-apple-darwin 9:38 7:05 6:56-7:13
x86_64-unknown-linux-gnu 12:36 11:36 10:36-12:35

Artifact sizes

This compares wheel artifacts from the same-source no-ICF control run with this PR's ICF rerun. The control commit changes only the workflow ICF toggle.

Wheel artifact No ICF bytes ICF bytes Delta
wheels_uv-macos-x86_64 23278539 22839695 -1.89%
wheels_uv-aarch64-apple-darwin 21760071 21518309 -1.11%
wheels_uv-x86_64-unknown-linux-gnu 24857925 24854207 -0.01%
wheels_uv_build-macos-x86_64 1473768 1467721 -0.41%
wheels_uv_build-aarch64-apple-darwin 1378633 1366300 -0.89%
wheels_uv_build-x86_64-unknown-linux-gnu 1608666 1608905 +0.01%

The corresponding embedded executable deltas are -2.02% for macOS x86_64 uv, -1.41% for macOS aarch64 uv, -0.67% for macOS x86_64 uv-build, -0.66% for macOS aarch64 uv-build, -0.01% for Linux x86_64 GNU uv, and approximately 0.00% for Linux x86_64 GNU uv-build.

@zanieb zanieb changed the title Use ICF in release builds Use ICF in macOS release builds to reduce binary sizes Jun 8, 2026
@zanieb zanieb added the releases Related to building and distributing release artifacts of uv label Jun 8, 2026
@zanieb zanieb marked this pull request as ready for review June 8, 2026 17:24
@zsol zsol self-requested a review June 8, 2026 17:36
@codspeed-hq

codspeed-hq Bot commented Jun 8, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 5.85%

❌ 1 regressed benchmark
✅ 12 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime unpack_sdist_many_files 1 s 1.1 s -5.85%

Tip

Investigate this regression with the CodSpeed MCP and your agent.


Comparing zb/icf (c91cff9) with main (89f28ab)

Open in CodSpeed

@zsol zsol left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems a bit counterintuitive that runs with ICF are consistently faster. What should we keep an eye out for in terms of potential negative consequences? Nonsense stack traces in panics?

@zanieb zanieb merged commit 3b8e3ca into main Jun 9, 2026
263 of 274 checks passed
@zanieb zanieb deleted the zb/icf branch June 9, 2026 14:02
@konstin konstin added the enhancement New feature or improvement to existing functionality label Jun 10, 2026
konstin added a commit that referenced this pull request Jun 10, 2026
Released on 2026-06-10.

### Enhancements

- Add `--emit-index-url` and `--emit-find-links` to `uv export`
([#18370](#18370))
- Add `--find-links` support for `uv pip list`
([#16103](#16103))
- Group executable install errors during `uv python install`
([#19691](#19691))
- Use ICF in macOS release builds to reduce binary sizes
([#19615](#19615))

### Preview features

- Add initial hidden `uv upgrade` command
([#19678](#19678))
- Reject Git revisions in `uv upgrade`
([#19742](#19742))

### Configuration

- Recognize `UV_NO_INSTALL_PROJECT`, `UV_NO_INSTALL_WORKSPACE`,
`UV_NO_INSTALL_LOCAL`
([#19323](#19323))

### Performance

- Speed up discovery of large workspaces
([#18311](#18311))

### Bug fixes

- Allow unknown preview flags with a warning again
([#19669](#19669))
- Apply dependency exclusions to direct requirements
([#19699](#19699))
- Avoid following external symlinks during cache clean
([#19682](#19682))
- Avoid following symlinks during cache prune
([#19543](#19543))
- Fix Git cache keys for worktrees and packed refs
([#19706](#19706))
- Make resolver error handling iterative to avoid stack overflows
([#19695](#19695))
- Pass `VIRTUAL_ENV` through `cygpath` inside `fish` on Windows
([#19703](#19703))
- Rebuild explicit local directory tool installs
([#19591](#19591))
- Validate egg top-level entries as identifiers
([#19679](#19679))

### Documentation

- Document `--find-links` caching behavior
([#19585](#19585))
- Add a small section for malware checks
([#19680](#19680))
blake-hamm added a commit to blake-hamm/bhamm-lab that referenced this pull request Jun 10, 2026
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [ghcr.io/astral-sh/uv](https://github.com/astral-sh/uv) | stage | patch | `0.11.19` → `0.11.20` |

---

### Release Notes

<details>
<summary>astral-sh/uv (ghcr.io/astral-sh/uv)</summary>

### [`v0.11.20`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#01120)

Released on 2026-06-10.

##### Enhancements

- Add `--emit-index-url` and `--emit-find-links` to `uv export` ([#&#8203;18370](astral-sh/uv#18370))
- Add `--find-links` support for `uv pip list` ([#&#8203;16103](astral-sh/uv#16103))
- Group executable install errors during `uv python install` ([#&#8203;19691](astral-sh/uv#19691))
- Use ICF in macOS release builds to reduce binary sizes ([#&#8203;19615](astral-sh/uv#19615))

##### Preview features

- Add initial hidden `uv upgrade` command ([#&#8203;19678](astral-sh/uv#19678))
- Reject Git revisions in `uv upgrade` ([#&#8203;19742](astral-sh/uv#19742))

##### Configuration

- Recognize `UV_NO_INSTALL_PROJECT`, `UV_NO_INSTALL_WORKSPACE`, `UV_NO_INSTALL_LOCAL` ([#&#8203;19323](astral-sh/uv#19323))

##### Performance

- Speed up discovery of large workspaces ([#&#8203;18311](astral-sh/uv#18311))

##### Bug fixes

- Allow unknown preview flags with a warning again ([#&#8203;19669](astral-sh/uv#19669))
- Apply dependency exclusions to direct requirements ([#&#8203;19699](astral-sh/uv#19699))
- Avoid following external symlinks during cache clean ([#&#8203;19682](astral-sh/uv#19682))
- Avoid following symlinks during cache prune ([#&#8203;19543](astral-sh/uv#19543))
- Fix Git cache keys for worktrees and packed refs ([#&#8203;19706](astral-sh/uv#19706))
- Make resolver error handling iterative to avoid stack overflows ([#&#8203;19695](astral-sh/uv#19695))
- Pass `VIRTUAL_ENV` through `cygpath` inside `fish` on Windows ([#&#8203;19703](astral-sh/uv#19703))
- Rebuild explicit local directory tool installs ([#&#8203;19591](astral-sh/uv#19591))
- Validate egg top-level entries as identifiers ([#&#8203;19679](astral-sh/uv#19679))

##### Documentation

- Document `--find-links` caching behavior ([#&#8203;19585](astral-sh/uv#19585))
- Add a small section for malware checks ([#&#8203;19680](astral-sh/uv#19680))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yMjAuMCIsInVwZGF0ZWRJblZlciI6IjQzLjIyMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->

Co-authored-by: Renovate Bot <renovate@bhamm-lab.com>
Reviewed-on: https://codeberg.org/blake-hamm/bhamm-lab/pulls/186
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or improvement to existing functionality releases Related to building and distributing release artifacts of uv

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants