Skip to content

Cache one copy of the install plan - #12572

Open
PaleRoses wants to merge 3 commits into
haskell:masterfrom
PaleRoses:one-cached-plan
Open

PaleRoses wants to merge 3 commits into
haskell:masterfrom
PaleRoses:one-cached-plan

Conversation

@PaleRoses

Copy link
Copy Markdown
Contributor

This removes the duplicate plans from cache/improved-plan. On master, the build cache holds every unit of the install plan three times: once in elaborated-plan and twice in improved-plan. The improved plan is the elaborated plan with units found in the store marked as installed.

improved-plan now holds the set of the plan's units that are in the store, keyed by the set of configured units. The store directory is monitored as before, and the marking is redone from the set on each run. An improved-plan written by an older cabal is treated as stale and overwritten without re-solving.

This is the follow-up I offered on #12463. It applies with or without #12464 and #12500. Each unit still keeps its own copy of the finalized PackageDescription, the follow-up already named in #12464.

I measured HLS at bc2bbb8e with the method from #12464, using GHC 9.12.4, -O1, assertions enabled and a populated dependency store. These are medians of six order-balanced cabal build all --dry-run runs on a shared macOS development machine. I applied the diff to 0687f8d2f. For the last column, I added one entry to the store between runs.

Version improved-plan whole cache/ No-op run Run after the store changed
master 0687f8d2f 59.7 MB 93.5 MB 1.22 s 1.79 s
This PR 0.02 MB 33.8 MB 0.797 s 0.786 s
#12464 + #12500 22.9 MB 39.0 MB 0.419 s 0.610 s
#12464 + #12500 + this PR 0.02 MB 16.2 MB 0.250 s 0.252 s

The dry-run build list and plan.json were identical with and without the PR on every run, including after store additions and removals and toggling --disable-tests and back.

AI disclosure: written with Claude Code (Fable 5.2 and Opus 5.5).


QA Notes

Build a project with a dependency from Hackage; dist-newstyle/cache/improved-plan is a few KB. Build again; the second build is up to date. Delete the dependency's directory from the store; cabal build --dry-run lists it again. StoreUnitRemoved covers this.

PaleRoses and others added 3 commits November 10, 2026 15:31
The improved-plan cache held the improved plan and the elaborated plan it
was made from, beside the elaborated-plan cache that already holds the
latter. The improved plan is the elaborated plan with the units found in
the store marked as installed, so improved-plan now holds only which of
the plan's units are in the store, and the marking is redone from that
set on each run. The store directory is monitored as before.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
A dependency is planned until it is in the store and planned again once
it is removed from there, with the project unchanged. OfflineFlag covers
the first half; nothing covered the second.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant