You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Boot sweep spawns 166 parallel du walks over 96 GB on every launch, then discards the result #563
duBytes spawns du -sk <dir> (worktrees.js:3609). On this machine that is 166 concurrent du processes walking 96 GB (median worktree 709 MB, each with a full node_modules) — on every single launch, cold page cache, right when the app is also parsing the 143 MB store (#225) and painting first frames.
And the sizes are never used. Retention selection keeps the newest N by threadActivityAt (worktrees.js:3791) — activity time, not size. The bytes field exists for the GC dialog's UI. With worktreeRetention unset on every project (the #559 finding), the entire scan output is discarded:
// worktrees.js:3789-3790constn=Math.floor(Number(project&&project.worktreeRetention));if(!(n>0))continue;// ← every project, today
So the steady state is: 166 process spawns + a 96 GB I/O walk per boot, for a no-op.
Fix (two lines of shape, no new machinery)
gcScan takes skipSizes (or enforceRetention passes a flag through): the enforce path never needs du. Candidates and classification are stat + git only.
Short-circuit enforceRetention before scanning when no project has worktreeRetention > 0 — with the setting unset there is nothing to enforce, so don't scan at all.
The GC dialog keeps sizing directories — that scan is user-initiated and the bytes are the point there. If #559 lands a retention default, fix 1 alone still removes the du storm from every boot; the scan the enforce path actually needs (readdir + git status per candidate) is cheap.
Tests
enforceRetention on a store where no project sets retention resolves without calling the du spawner (assert via the existing setExecFile seam).
With retention set, enforcement still removes past-limit worktrees without du having run.
gcScan without skipSizes (dialog path) still reports bytes and totalBytes.
Related
#559 (retention default — makes the enforce-path scan do real work), #316 (the engine), #418 (startup wins), #359 (same class: spawn cost on hot paths).
Fixed in 8516d61. enforceRetention short-circuits before any disk scan when no project sets worktreeRetention (all five today), and threads skipSizes through gcScan/gcClean when a limit IS set, since retention picks by threadActivityAt, never bytes. Removes the 166-process du storm over 96 GB on every cold boot; the GC dialog still sizes on demand. Tests: electron/test/worktree-gc.test.js (16/16) with a du-spawn spy asserting zero spawns on both enforce paths.
Activity
currentbits commentedon Aug 19, 2026
Fixed in 8516d61. enforceRetention short-circuits before any disk scan when no project sets worktreeRetention (all five today), and threads skipSizes through gcScan/gcClean when a limit IS set, since retention picks by threadActivityAt, never bytes. Removes the 166-process du storm over 96 GB on every cold boot; the GC dialog still sizes on demand. Tests: electron/test/worktree-gc.test.js (16/16) with a du-spawn spy asserting zero spawns on both enforce paths.
Boot retention: skip the du walk entirely (#563)