From 164ecfcc4c36d3405cd61a9152e4038005f952b3 Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sat, 7 Nov 2026 08:06:01 +0000 Subject: [PATCH 1/2] build: build released wheels with one codegen unit per crate --- .github/workflows/build-distributions.yml | 9 +++++++-- .github/workflows/verify.yml | 2 ++ Cargo.toml | 8 +++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-distributions.yml b/.github/workflows/build-distributions.yml index 12a3661dac..650353ebf1 100644 --- a/.github/workflows/build-distributions.yml +++ b/.github/workflows/build-distributions.yml @@ -34,6 +34,11 @@ on: required: false type: number default: 0 + cargo-profile: + description: "Cargo profile of the native builds: dist for released wheels, release for quicker checks" + required: false + type: string + default: dist outputs: sha: description: "Commit the distributions were built from" @@ -141,7 +146,7 @@ jobs: command: build # One platform records a cargo build timing report for build time work. args: >- - --release --out dist --features extension-module + --profile ${{ inputs.cargo-profile }} --out dist --features extension-module ${{ matrix.platform.name == 'linux-x86_64' && '--timings' || '' }} target: ${{ matrix.platform.target }} manylinux: auto @@ -159,7 +164,7 @@ jobs: with: command: build args: >- - --release --out dist --manifest-path crates/sqlbuild-cli/Cargo.toml --features ui + --profile ${{ inputs.cargo-profile }} --out dist --manifest-path crates/sqlbuild-cli/Cargo.toml --features ui ${{ matrix.platform.name == 'linux-x86_64' && '--timings' || '' }} target: ${{ matrix.platform.target }} manylinux: auto diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 5661db7674..114ea51c4b 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -1099,6 +1099,8 @@ jobs: sdist: false upload: true retention-days: 3 + # Release Distributions builds and smoke tests the slower dist profile for every release. + cargo-profile: release compose: name: Packaged Compose lifecycle diff --git a/Cargo.toml b/Cargo.toml index bb3bb388e2..9ef850601d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -203,8 +203,14 @@ debug = false [profile.release] strip = "symbols" +# Released wheels: one codegen unit per crate keeps one copy of generic code that parallel units +# each instantiate, so the native binaries are about an eighth smaller and build in about 2x time. +[profile.dist] +inherits = "release" +codegen-units = 1 + # Local iteration: release-level optimisation with incremental builds, so rebuilding after a -# focused change does not recompile the whole binding crate. CI and wheels use `release`. +# focused change does not recompile the whole binding crate. CI uses `release`. [profile.fast] inherits = "release" incremental = true From d00a761ee0d07b766b0cc3d1e7fbf89c2a46e70b Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sat, 7 Nov 2026 08:24:26 +0000 Subject: [PATCH 2/2] build: allow the slower dist builds and compare like with like 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. --- .github/workflows/build-distributions.yml | 3 ++- .github/workflows/release-performance.yml | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-distributions.yml b/.github/workflows/build-distributions.yml index 650353ebf1..99770a02e4 100644 --- a/.github/workflows/build-distributions.yml +++ b/.github/workflows/build-distributions.yml @@ -93,7 +93,8 @@ jobs: name: Build wheel (${{ matrix.platform.name }}) needs: source runs-on: ${{ matrix.platform.runner }} - timeout-minutes: 75 + # Cold dist builds take up to about 2x the 17-31 minute release-profile jobs on Windows and macOS. + timeout-minutes: 120 strategy: fail-fast: false matrix: diff --git a/.github/workflows/release-performance.yml b/.github/workflows/release-performance.yml index c9ddef80e3..00d27f1f14 100644 --- a/.github/workflows/release-performance.yml +++ b/.github/workflows/release-performance.yml @@ -66,7 +66,10 @@ jobs: run: uv python install 3.12 - name: Install dependencies run: uv sync --locked --all-groups --all-extras + # The candidate uses the released wheels' cargo profile, so both sides of the comparison match. - name: Build candidate wheel + env: + MATURIN_PEP517_ARGS: --profile dist run: | uv build --wheel --out-dir "${RUNNER_TEMP}/candidate" uv build --wheel crates/sqlbuild-cli --out-dir "${RUNNER_TEMP}/candidate"