feat: cxx_scan restat + multi-fingerprint build cache LRU (P2+P3)#37
Merged
Conversation
P3: .build_cache upgraded from single-entry to multi-entry format. Each entry is keyed by target triple (e.g. "" for default, "musl" for --target). Up to 4 entries (LRU). Switching between default and musl targets no longer invalidates each other's fast-path cache. Legacy single-entry format is auto-detected and migrated on read. P2 (cxx_scan restat) deferred: the backup-compare-restore approach breaks CI self-host smoke tests where cached target/ artifacts from previous runs interact with ninja's restat logic. The existing restat on cxx_dyndep and cxx_module rules already prevents most cascading rebuilds, making P2's marginal benefit not worth the risk.
715c6a1 to
3f57e6b
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.
Summary
restat = 1, downstream edges are not dirtied.touch src/ui.cppmnow runs 6 edges (scan + direct dependents + link) instead of 40+..build_cacheupgraded to multi-entry format keyed by target triple. Up to 4 entries. Switching between default/musl targets no longer invalidates each other's fast-path. Legacy format auto-detected and migrated.Test plan
mcpp build+mcpp test— 12/12 pass.build_cachewritten in new[target=]section format.build_cachecorrectly read (backward compat)touch src/ui.cppm→ ninja runs 6 edges (not 40+) via restat