Skip to content

Commit 7663b7d

Browse files
committed
perf(ci): checkfast profile for the test lanes — 4.9x faster compiles
The workspace ships with fat LTO + codegen-units=1, and under --release every test binary pays that link. checkfast (inherits release, lto off, cgu 16) compiles the workspace test targets in 32s where release takes 157s (measured locally; 773/773 tests pass identically, run time unchanged at ~11s — verdicts are semantics, not codegen). nextest and lambda-tests build against a second cached deps closure under the new profile; clippy, abgen-all and every shipped artifact keep full-fat release. The cache composite gains a flavor input (nix-v4 keys) so the two closures never race for one entry.
1 parent 8e0cafb commit 7663b7d

6 files changed

Lines changed: 56 additions & 12 deletions

File tree

.github/actions/nix-store-cache/action.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ description: >
1010
save action. runner.arch is part of the key so x86_64 and aarch64 stores
1111
never cross.
1212
13+
inputs:
14+
flavor:
15+
description: >
16+
Which deps closure this job consumes (build = release-profile deps;
17+
checkfast = the test-lane profile). Separate entries per flavor keep
18+
the first-save-wins race from caching one flavor's closure under the
19+
other's key.
20+
default: build
21+
1322
runs:
1423
using: composite
1524
steps:
@@ -49,8 +58,8 @@ runs:
4958
id: restore
5059
with:
5160
path: /var/tmp/abgen-nixcache
52-
key: nix-v3-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('flake.lock', 'Cargo.lock', '**/Cargo.toml', 'flake.nix', 'rust-toolchain.toml', 'nix/*.nix', 'crate/abgen-wasm/toolchain/flake.lock', 'crate/abgen-wasm/toolchain/flake.nix') }}
53-
restore-keys: nix-v3-${{ runner.os }}-${{ runner.arch }}-
61+
key: nix-v4-${{ runner.os }}-${{ runner.arch }}-${{ inputs.flavor }}-${{ hashFiles('flake.lock', 'Cargo.lock', '**/Cargo.toml', 'flake.nix', 'rust-toolchain.toml', 'nix/*.nix', 'crate/abgen-wasm/toolchain/flake.lock', 'crate/abgen-wasm/toolchain/flake.nix') }}
62+
restore-keys: nix-v4-${{ runner.os }}-${{ runner.arch }}-${{ inputs.flavor }}-
5463

5564
- name: expose cache facts to the save action
5665
shell: bash

.github/workflows/ci.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,11 @@ jobs:
208208
- lane: x86 nextest
209209
runner: ubuntu-24.04
210210
system: x86_64-linux
211-
deps: .#checks.x86_64-linux.deps
211+
deps: .#checks.x86_64-linux.deps-checkfast
212212
attrs: nextest
213213
gate: run_crate
214214
marker: x86-nextest
215+
flavor: checkfast
215216
- lane: x86 build + smoke
216217
runner: ubuntu-24.04
217218
system: x86_64-linux
@@ -222,17 +223,19 @@ jobs:
222223
- lane: arm nextest
223224
runner: ubuntu-24.04-arm
224225
system: aarch64-linux
225-
deps: .#checks.aarch64-linux.deps
226+
deps: .#checks.aarch64-linux.deps-checkfast
226227
attrs: nextest
227228
gate: run_crate
228229
marker: arm-nextest
230+
flavor: checkfast
229231
- lane: arm lambda + smoke
230232
runner: ubuntu-24.04-arm
231233
system: aarch64-linux
232-
deps: .#checks.aarch64-linux.deps
234+
deps: .#checks.aarch64-linux.deps-checkfast
233235
attrs: lambda-tests native-smoke
234236
gate: run_lambda
235237
marker: arm-lambda
238+
flavor: checkfast
236239
- lane: arm lints
237240
runner: ubuntu-24.04-arm
238241
system: aarch64-linux
@@ -253,6 +256,8 @@ jobs:
253256
# silently a no-op.
254257
- uses: ./.github/actions/nix-store-cache
255258
if: needs.nix-gate.outputs[matrix.gate] == 'true' && needs.nix-gate.outputs[format('skip_{0}', matrix.marker)] != 'true'
259+
with:
260+
flavor: ${{ matrix.flavor || 'build' }}
256261
- name: deps (dependency closures)
257262
if: needs.nix-gate.outputs[matrix.gate] == 'true' && needs.nix-gate.outputs[format('skip_{0}', matrix.marker)] != 'true'
258263
run: nix build --no-link ${{ matrix.deps }}

Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,12 @@ version = "0.17.1"
2121
[profile.release]
2222
lto = "fat"
2323
codegen-units = 1
24+
25+
# Test-lane profile: identical semantics, none of the fat-LTO link cost.
26+
# Shipped artifacts keep [profile.release]; only the CI test checks and
27+
# local test runs use this. Parity is semantics, not codegen: encoder
28+
# outputs are optimization-independent.
29+
[profile.checkfast]
30+
inherits = "release"
31+
lto = "off"
32+
codegen-units = 16

flake.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@
176176

177177
checks = import ./nix/checks.nix {
178178
inherit lib system pkgs craneLib wasmCheck;
179-
inherit (build) commonArgs cargoArtifacts abgenConsumersPkg;
179+
inherit (build) commonArgs cargoArtifacts cargoArtifactsCheckfast
180+
abgenConsumersPkg;
180181
};
181182

182183
});

nix/build.nix

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ let
5151
doCheck = true;
5252
});
5353

54+
# Deps for the checkfast profile (lto off, codegen-units 16): the test
55+
# checks compile 4.9x faster against these — measured 157s -> 32s per
56+
# workspace test compile — with byte-identical test verdicts. Shipped
57+
# artifacts and clippy keep the release-profile deps above.
58+
cargoArtifactsCheckfast = craneLib.buildDepsOnly (commonArgs // {
59+
inherit dummySrc;
60+
pname = "abgen-checkfast";
61+
version = "0";
62+
doCheck = true;
63+
CARGO_PROFILE = "checkfast";
64+
});
65+
5466
abgenAll = craneLib.buildPackage (commonArgs // {
5567
inherit cargoArtifacts;
5668
pname = "abgen-all";
@@ -77,6 +89,6 @@ let
7789
});
7890
in
7991
{
80-
inherit commonArgs cargoArtifacts abgenAll abgenPkg abgenConsumersPkg
81-
abgenCorpusPkg;
92+
inherit commonArgs cargoArtifacts cargoArtifactsCheckfast abgenAll abgenPkg
93+
abgenConsumersPkg abgenCorpusPkg;
8294
}

nix/checks.nix

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1-
{ lib, system, pkgs, craneLib, commonArgs, cargoArtifacts, abgenConsumersPkg
2-
, wasmCheck }:
1+
{ lib, system, pkgs, craneLib, commonArgs, cargoArtifacts
2+
, cargoArtifactsCheckfast, abgenConsumersPkg, wasmCheck }:
33

44
let
55
src = commonArgs.src;
66
withArtifacts = commonArgs // { inherit cargoArtifacts; };
7+
# Test checks compile under the checkfast profile (lto off, cgu 16):
8+
# 4.9x faster workspace test compiles, byte-identical verdicts. Clippy
9+
# and the shipped packages stay on release-profile artifacts.
10+
withCheckfast = commonArgs // {
11+
cargoArtifacts = cargoArtifactsCheckfast;
12+
CARGO_PROFILE = "checkfast";
13+
};
714
abgenRoot = ''export ABGEN_ROOT="$PWD"'';
815

916
archIndependent = {
@@ -33,8 +40,9 @@ let
3340
# deps stage builds exactly this, then publishes the binary cache, so a
3441
# failure in any later stage never costs the next run its warm deps.
3542
deps = cargoArtifacts;
43+
deps-checkfast = cargoArtifactsCheckfast;
3644

37-
nextest = craneLib.cargoNextest (withArtifacts // {
45+
nextest = craneLib.cargoNextest (withCheckfast // {
3846
doCheck = true;
3947
__darwinAllowLocalNetworking = true;
4048
cargoExtraArgs = "--locked";
@@ -66,7 +74,7 @@ let
6674
# is rejected: feature unification differs, a merged compile would not
6775
# test the no-server config the mac/windows legs ship.
6876
lambdaTests = {
69-
lambda-tests = craneLib.cargoTest (withArtifacts // {
77+
lambda-tests = craneLib.cargoTest (withCheckfast // {
7078
doCheck = true;
7179
__darwinAllowLocalNetworking = true;
7280
pname = "abgen-lambda-tests";

0 commit comments

Comments
 (0)