Skip to content

build: build released wheels with one codegen unit per crate - #1340

Merged
kvlonge merged 4 commits into
mainfrom
build/smaller-wheels
Nov 7, 2026
Merged

kvlonge merged 4 commits into
mainfrom
build/smaller-wheels

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Why

Every release adds about 230 MB to PyPI, which hit its 25 GB limit with 0.195.0. The native extension is almost the whole wheel (43 of 45 MB compressed); it is already stripped, so the bulk is generic code that the default 16 parallel codegen units each instantiate.

Changes

  • New dist cargo profile: release with codegen-units = 1.
  • Build Distributions takes a cargo-profile input, defaulting to dist, for both native builds. Release Distributions and Publish therefore build released wheels with it unchanged.
  • Verify's pull request wheel job keeps release, so its build time does not double.
  • Wheel job timeout 75 to 120 minutes: cold Windows and macOS jobs take 17-31 minutes today, and dist about doubles the native builds.
  • Release Performance builds its candidate with dist, like the published baseline.

Rejected: fat LTO with 1 unit gave 40.1 MB at 3.1x build time and 7.9 GB peak; fat LTO with 16 units saved 0.4%.

DuckShop: not applicable. This is a build profile; compiled output is identical.

Verification

Same orb, rustc 1.99.1, linux x86_64, cold builds:

release dist
sqlbuild wheel 45.03 MB 39.29 MB (-12.7%)
sqlbuild-cli wheel 14.55 MB 12.16 MB (-16.4%)
extension build wall 442 s 917 s
extension build user CPU 2471 s 2004 s
peak build RSS 5.5 GB 5.9 GB
  • Dense 3,000-model compile, 5 alternating runs, medians: cold wall 8.16 to 8.12 s (CPU 0.996x), cold writing the cache 1.002x, warm 0.25 s both. Compiled files and compile JSON excluding timings are identical.
  • Test-built wheels in a clean Python 3.12 venv: native import, sqb playground pg compile and build PASS=99, sqb server serving /, deep links, /login.
  • uv build with MATURIN_PEP517_ARGS=--profile dist runs maturin pep517 build-wheel --profile dist and builds into target/dist.
  • The first Release Distributions run measures dist on every platform.
  • make check-ci, public-repository scan.

Raise the wheel job timeout to 120 minutes for cold dist builds on Windows and
macOS, and build the release-performance candidate with the dist profile the
published baseline uses.
@kvlonge
kvlonge enabled auto-merge (squash) November 7, 2026 08:39
@kvlonge
kvlonge merged commit a0a6a89 into main Nov 7, 2026
51 checks passed
@kvlonge
kvlonge deleted the build/smaller-wheels branch November 7, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant