Repository navigation
Collect idle and obsolete shared ThinLTO caches - #164
Open
charliermarsh wants to merge 1 commit into
Open
charliermarsh wants to merge 1 commit into
charliermarsh wants to merge 1 commit into
Conversation
charliermarsh
force-pushed
the
codex/thinlto-build-cache-gc
branch
from
October 17, 2026 01:25
fec4973 to
35477e3
Compare
charliermarsh
changed the base branch from
codex/per-dependency-build-cache-gc
to
charlie/codex-defer-dev-deps
October 17, 2026 01:25
This was referenced Oct 17, 2026
charliermarsh
added a commit
to astral-experiments/ohm
that referenced
this pull request
Oct 17, 2026
Prepare Ohm 1.99.0-5 with the check-to-build query-feed fix in astral-experiments/ohm-rust#187 and manual collection of shared ThinLTO caches in astral-experiments/ohm-cargo#164. The compiler's Cargo gitlink matches the manifest's Cargo revision. The manifest, source revisions, manifest history, and formatting checks pass. The optimizations guide is updated separately in #151 for review.
charliermarsh
force-pushed
the
codex/thinlto-build-cache-gc
branch
from
October 17, 2026 12:44
35477e3 to
78f286e
Compare
charliermarsh
added a commit
to astral-experiments/ohm
that referenced
this pull request
Oct 17, 2026
Update the Cargo pin in the unpublished Ohm 1.99.0-5 manifest to include the retained-native-archive support in astral-experiments/ohm-cargo#161 and the rebased ThinLTO cleanup change in astral-experiments/ohm-cargo#164. Align the compiler's Cargo gitlink with the manifest. The source revisions, manifest history, and formatting checks pass.
charliermarsh
force-pushed
the
codex/thinlto-build-cache-gc
branch
4 times, most recently
from
October 17, 2026 15:52
e723256 to
c034241
Compare
charliermarsh
force-pushed
the
codex/thinlto-build-cache-gc
branch
from
November 17, 2026 06:26
c034241 to
e61146b
Compare
charliermarsh
force-pushed
the
codex/thinlto-build-cache-gc
branch
from
November 17, 2026 07:02
e61146b to
44fe865
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cargo +ohm gcnow reclaims individual shared ThinLTO backend objects after one hour without compiler use, and entire obsolete contexts immediately after an Ohm upgrade or compiler replacement. Cleanup remains manual, respects active consumers, and leavescargo cleanscoped to the current workspace.We place shared ThinLTO objects under the existing compiler context and reuse its SQLite provenance and consumer lease. Rustc already refreshes object modification times on cache hits, so this adds no database tables, rows, or warm-build timestamp updates. Compatible worktrees continue to share backend objects. Recognized old flat ThinLTO namespaces are immediately eligible as legacy data; they are not imported into the new layout. If provenance cannot be recorded, new optional state stays private.
Shared ThinLTO caches no longer scan or prune at build completion. Explicit GC selects idle objects outside build locks, revalidates them under the existing locks, and retires bounded batches with the same 10 ms retirement budget. It also collects abandoned temporary entries and coordinates with the old automatic pruner. Unknown records, symlinks, active consumers, and dry-run semantics retain their existing protections.
The focused checks pass 38 GC unit tests, six ThinLTO management tests, and 18 command tests, plus Clippy. Full CI passes, including Cargo tests and Clippy on Linux and macOS, workspace tests, resolver tests, schemas, and formatting. Coverage includes expiry within an active context, refreshed objects, immediate upgrade cleanup, legacy caches, active leases, interruption and resumption, file and byte counts, compiler path selection, and warm builds after eviction. The local default Ohm compiler predates the backend cache feature, so the compiler-path integration uses an adapter; this verifies Cargo’s compiler-path and cleanup integration.
Warm-build measurements against #161 used isolated roots and balanced run order. On the 11-variant workload, 180 runs per binary measured 53.51 ms before and 53.30 ms after (paired -0.16%, 95% interval -1.98% to +0.67%). With 10,000 synthetic ThinLTO objects and a compiler adapter, 100 fresh release builds per binary measured 53.46 ms before and 53.57 ms after (paired -0.08%, 95% interval -3.00% to +1.98%). Neither comparison establishes a regression, and all 560 timed builds stayed fresh. Sampled warm invocations left the database and WAL unchanged. Fully fresh builds already skipped the old pruner; removing the end-of-build scan benefits builds that invoke the backend. The synthetic fixture measures Cargo bookkeeping, not LLVM cache-hit performance.
The 10,000-object cleanup fixture reclaimed all 10.4 MiB of idle objects while preserving a fresh object. It took 2 invocations totaling 16.8 seconds under the existing 10-second per-root collection limit, and a final dry run reported zero eligible files.