Skip to content

mcppls-clangd 0.0.12: preambles kept for files mixing headers with imports; typing, edits and lost BMIs do not wait on module rebuilds - #4

Merged
Sunrisepeak merged 28 commits into
mainfrom
release/0.0.12-perf
Oct 11, 2026
Merged

Sunrisepeak merged 28 commits into
mainfrom
release/0.0.12-perf

Conversation

@Sunrisepeak

@Sunrisepeak Sunrisepeak commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Engine fixes found by running mcpp-language-server's conformance and ux scenarios against the maintained engine and against stock clangd 23.1. The scenarios were ux-xlings and ux-mcpp on four cores, typing-import under PRoot on two cores, and new Qt and <windows.h> module fixtures. Each fix is folded into the patch it belongs to; patches/PATCHES.md lists them per patch.

Files mixing heavy headers with module imports keep their preamble (0014, 0023).

  • Before, a file that includes Qt or <windows.h> and imports modules was parsed in full for every request.
    • The scan memo refused compilers with a clang++.cfg (xlings/mcpp LLVM) and every non-Linux host.
    • The preamble audit compared the temporary directory's time.
    • A later scan of the same prefix recorded its inputs under another key.
  • Now the preamble holds as long as the files its own construction read replay unchanged.
  • A preamble found incompatible logs which check failed, down to the file PrecompiledPreamble::CanReuse found changed (new optional reason out-parameter).
  • Qt importer completion: 0.58 s → 0.05 s (stock 0.58 s).

Typing does not wait on module rebuilds (0014, 0025).

  • Completion in the module/import declarations, including a blank line among them, skips the module refresh.
  • An import that nothing in the project builds keeps the preamble's modules.
  • An edited dependency's rebuild is waited for up to 250 ms. Past that, completion answers from the modules as they were, and the rebuild continues in the background.
  • A memo hit no longer re-reads settled headers.

The owned module cache (0019, 0021).

  • Consumer keys. A consumer's key names its producers by name, size and a digest of their bytes. It no longer uses their file identity or the path they were published to. A module rebuilt to the same bytes (lost, evicted or damaged BMI) keeps its importers. Before, all of them were rebuilt: 42 for one lost module in ux-mcpp, and U11 recovery went from 25–36 s to 6.6 s (0.0.11: 7.3 s).
  • Lookups. A lookup tries the slot where it last found its key first. Before, each prerequisite cost about 12 ms (a lease and a ledger read per slot). An admission scan checks the ledger's identity once instead of at every slot.
  • Kept prerequisites. The builder keeps each file's last prerequisites, for at most 32 files, and lets them go under admission pressure. Before, a set dropped for a moment (an import being typed, a bounded build answering late) was copied again module by module: 291 BMI copies in one 2.5-minute typing run.
  • Payload bound. A clangd started with another payload bound adopts the ledger instead of failing every build.
  • ux-xlings completion while typing: U5 p95 1.00 s → 0.23 s, U6 (autosave) 1.00 s → 0.46 s. The engine share of completion is back at 0.80+.

Robustness.

  • 0019: a changed stable payload is skipped instead of failing the module for good.
  • 0017: a worker tolerates an unbuilt command directory.
  • The package proves a new feature, unresolved-import-recovery (ci/unresolved_import_canary.py). Stock 23.1 gives no answer within 60 s; this engine answers in 77 ms.

CI. Every platform's PR build is packaged as clangd-<platform>-portable. mcpp-language-server PR #46 tests these packages before this PR merges (see the README, "Integrating with mcppls").

Patched tree: 3e8bb5b0.

… and a changed stable payload is skipped

Two defects the product's ux scenarios found on four cores (ux-xlings), each
folded into the patch it belongs to:

- 0025: completion compared the draft's imports with the preamble's and, when
  they differed, rebuilt the whole prerequisite set inside the request. Typing
  an import line changes the draft's imports at every key, so every completion
  there rebuilt about 94 modules (0.8-2.5 s each, against 5-80 ms with stock
  clangd). Completion inside the preamble region parses the draft alone,
  without the preamble or what its modules export, so their freshness is not
  checked there; completion below the imports keeps the refresh. A
  PrerequisiteModulesTests case asserts no prerequisite lookup in an import
  line and module exports in the body.
- 0019: ModuleBuildCache::lookup failed the module ("stable payload changed")
  when a stable generation's payload no longer matched its record, so a BMI
  truncated by a crash or another program failed that module and every
  importer until the cache was reset (ux U9 waited 122 s; U11 found nothing to
  rebuild). Such a generation is now skipped like one that fails validation,
  the module builds into a new generation, and the old one keeps its charge
  until bounded collection.
…othing builds, and waits 250 ms for a rebuild it needs
…n; only an edited dependency's rebuild is bounded
…ntegration run; a soak check waits for the kill
…oized, and the first input that replays differently is logged
…xing headers with imports keep their preamble
…ized on every host, so Windows and macOS files mixing headers with imports keep their preamble
@Sunrisepeak Sunrisepeak changed the title mcppls-clangd 0.0.12: an import being typed does not rebuild prerequisites; a changed stable payload is skipped mcppls-clangd 0.0.12: preambles kept for files mixing headers with imports; typing and edits do not wait on module rebuilds Oct 10, 2026
…draft does not invalidate the scans that walked its folder
… set dropped for a moment is not copied again
…ads replay unchanged, whatever key another scan of its prefix gets
… textual preamble proof is documented where it is declared
@Sunrisepeak Sunrisepeak changed the title mcppls-clangd 0.0.12: preambles kept for files mixing headers with imports; typing and edits do not wait on module rebuilds mcppls-clangd 0.0.12: preambles kept for files mixing headers with imports; typing, edits and lost BMIs do not wait on module rebuilds Oct 11, 2026
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