Commit 11c45be
committed
perf(rust): share one cargo target directory across checkouts
Each checkout builds its own complete target directory. Anyone keeping
several worktrees open pays it in full every time, roughly 1.8G each
after the dev profile change.
Move compiler output beside the checkout instead of inside it, so sibling
worktrees share one directory. Cargo resolves a relative target-dir
against the config file's parent, so a checkout at <path>/BrowserOS now
builds into <path>/shared-target. Measured locally: a first build takes
53.54s and produces a 1.8G shared directory; a second worktree then
builds in 20.07s and grows it only to 2.3G, reusing every dependency
artifact rather than adding another full copy.
Single-checkout clones are unaffected in practice, building one directory
higher than before.
CI is pinned back to the in-repo path with CARGO_TARGET_DIR, which takes
precedence over the config file. A workflow run has exactly one checkout
and gains nothing from sharing, and the BrowserClaw release locates its
compiled binary at packages/browseros-agent/target in three places: the
PostHog key check, the stamped version check, and packaging. Swatinem
rust-cache also resolves its cache path as workspace plus target and
never reads CARGO_TARGET_DIR, so an unpinned redirect would silently stop
caching. Both workflows that run cargo set it at the workflow level.
Anything added later that runs cargo in CI must set CARGO_TARGET_DIR too.1 parent e1bff79 commit 11c45be
3 files changed
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 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 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
28 | 33 | | |
29 | 34 | | |
30 | 35 | | |
| |||
0 commit comments