Commit e805ea4
committed
perf(rust): share intermediates via build-dir instead of moving target
target-dir has no path templating and cargo expands neither ~ nor $HOME,
so a committed value could only ever be relative to the checkout. That
limited sharing to sibling worktrees and, because it moved the final
artifacts too, required CARGO_TARGET_DIR pinned in two workflows to keep
the release steps able to locate a built binary.
build-dir does support templating. {cargo-cache-home} resolves to
CARGO_HOME, so one shared location covers every clone and worktree on a
machine rather than only siblings, and it stays portable with no absolute
path committed.
It also only moves intermediates. Final artifacts still land in
<checkout>/target, so the release steps keep working and both workflow
pins are gone: release-claw-server has none at all now, and test.yml
names the shared directory to rust-cache instead, which caches only
workspace target dirs plus the registry and git caches by default.
Measured across two checkouts of the same branch:
cold build 38.35s target 227M shared 1.6G
second checkout 16.14s target 227M shared 2.1G
and a release build against a warm shared directory still produces
target/release/browseros-claw-server-rs, which is the path the release
workflow reads.
The tradeoff against the previous form is ~227M left per checkout rather
than nothing, bought in exchange for machine-wide sharing and no
release-path coupling.1 parent e43ac4b commit e805ea4
3 files changed
Lines changed: 14 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | 78 | | |
85 | 79 | | |
86 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | 28 | | |
34 | 29 | | |
35 | 30 | | |
| |||
105 | 100 | | |
106 | 101 | | |
107 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
0 commit comments