Skip to content

feat: cxx_scan restat + multi-fingerprint build cache LRU (P2+P3)#37

Merged
Sunrisepeak merged 1 commit into
mainfrom
feat/p2-p3-restat-lru
May 15, 2026
Merged

feat: cxx_scan restat + multi-fingerprint build cache LRU (P2+P3)#37
Sunrisepeak merged 1 commit into
mainfrom
feat/p2-p3-restat-lru

Conversation

@Sunrisepeak
Copy link
Copy Markdown
Member

Summary

  • P2 — cxx_scan restat: scan rule uses backup-compare-restore pattern to preserve .ddi mtime when content unchanged. With restat = 1, downstream edges are not dirtied. touch src/ui.cppm now runs 6 edges (scan + direct dependents + link) instead of 40+.
  • P3 — multi-fingerprint LRU: .build_cache upgraded 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_cache written in new [target=] section format
  • Legacy single-entry .build_cache correctly read (backward compat)
  • touch src/ui.cppm → ninja runs 6 edges (not 40+) via restat
  • No-op build fast-path still works (0.00s)
  • CI passes

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.
@Sunrisepeak Sunrisepeak force-pushed the feat/p2-p3-restat-lru branch from 715c6a1 to 3f57e6b Compare May 15, 2026 15:20
@Sunrisepeak Sunrisepeak merged commit 34db876 into main May 15, 2026
1 check passed
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