Skip to content

Rust: Reuse the loaded workspace and load the next one in the background - #23335

Open
redsun82 wants to merge 6 commits into
redsun82-turbo-garbanzofrom
redsun82-bookish-pancake
Open

redsun82 wants to merge 6 commits into
redsun82-turbo-garbanzofrom
redsun82-bookish-pancake

Conversation

@redsun82

@redsun82 redsun82 commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: 8f6861cb4c3e94e14064540d5fcd8c93cf4fefe5

Dimension Assessment Rationale
Change confidence 8.5/10 ↑ At this head: 26/26 extractor unit tests, fmt and clippy pass; unit tests cover reuse, failed loads, the two-workspace bound, background overlap and drop waiting for an in-flight load.
↑ At this head's extractor: the new proc-macro-workspaces fixture (two workspaces using a local proc macro) gives the same expected calls at 1 and 4 threads via CLI emulation.
↑ At 9c50707 (same layer-5 code, older lower layers): calls, macro expansions, files, diagnostics and archives matched the stack base on dependency-features, a broken/loose-file case and ripgrep+fd+bat at -j1/-j8; Rust integration CI passed on all platforms, Windows on rerun.
↓ Since 9c50707 the lower layers were restacked; parity and DCA were not rerun on this head.
↓ Platform CI on this head is pending, including the first CI run of proc-macro-workspaces.

Layer 5 of the Rust extractor performance stack, on top of #23333.

  • LoadedWorkspaces keeps the last loaded workspace and, when extracting with more than one thread, loads the next manifest in a background thread while the current one is extracted. At most two workspaces are alive at once, so two proc-macro server pools; the in-flight load is joined on drop.
  • Workspaces are only reused for the exact same ProjectManifest. There is no fingerprinting, and failed loads are not cached.
  • In each dependency round the manifests are sorted, so the order is deterministic and the workspace still loaded from the previous phase comes first. Each file is selected for a single manifest per round, so this order doesn't change what gets extracted.
  • There are fewer LoadManifest steps, because the last per-file workspace is no longer reloaded for dependency extraction (hence the workspace-with-glob expectation change).

Cold codeql database create --threads=8, interleaved pairs:

  • Against layer 4 on ripgrep+fd+bat: 148/124/132s → 111/112/108s.
  • Whole stack against its base (6489640f): ripgrep 60.8 → 28.0s, ripgrep+fd+bat 185.8 → 107.4s (medians). User+sys time is unchanged; extractor peak RSS +8%.

@redsun82
redsun82 requested review from a team as code owners December 2, 2026 16:55
@redsun82
redsun82 requested an adaptive review from Copilot December 2, 2026 16:55
@github-actions github-actions Bot added the Rust Pull requests that update Rust code label Dec 2, 2026
@redsun82
redsun82 added this pull request to stack #23336 December 2, 2026 16:58

This comment was marked as outdated.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Missing integration coverage for overlapping real workspace loads leaves interactions between proc-macro server pools and shared build artifacts unverified across threading, prefetch, and reuse.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Low severity Test overlapping loads sharing proc macros and build artifacts

rust/​extractor/​src/​workspaces.rs:86

Please add an integration test for overlapping real workspace loads that share a procedural-macro dependency and build-script output, comparing extraction at one and multiple threads across prefetch and reuse. The new tests use a mock loader, while dependency-features exercises only macro_rules!, so neither checks interactions between the two proc-macro server pools and shared build artifacts.

1 resolved since last review

Review effort: Max (adaptive)

@redsun82
redsun82 force-pushed the redsun82-bookish-pancake branch from 9c50707 to 1bb0fcc Compare December 3, 2026 10:01
@redsun82
redsun82 requested an adaptive review from Copilot December 3, 2026 10:02

This comment was marked as outdated.

Paolo Tranquilli and others added 4 commits December 3, 2026 10:17
Keeps the two most recently used workspaces, so that extracting dependencies
does not reload workspaces still in memory, and loads the next manifest while
the current one is extracted when running on more than one thread.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8d0772f66a6b42c7b59d25b5e8f4073d
Older workspaces were never reused during per-file extraction, and each
holds its own proc-macro server pool.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8d0772f66a6b42c7b59d25b5e8f4073d
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8d0772f66a6b42c7b59d25b5e8f4073d
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8d0772f66a6b42c7b59d25b5e8f4073d
@redsun82
redsun82 force-pushed the redsun82-bookish-pancake branch from d833818 to 4c9ddfe Compare December 3, 2026 10:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human assessment is needed because multi-workspace prefetch with a live procedural-macro server lacks regression coverage across thread counts.

No open issues 🎉

1 resolved since last review

Review effort: Max (adaptive)

This comment was marked as outdated.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8d0772f66a6b42c7b59d25b5e8f4073d

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Overlapping Cargo loading and extraction share build artifacts while databases and proc-macro pools persist across phases, requiring human review of concurrency and resource-lifetime interactions.

No open issues 🎉

1 resolved since last review

Review effort: Max (adaptive)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8d0772f66a6b42c7b59d25b5e8f4073d

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Overlapping background Cargo loading with proc-macro extraction and retaining analyzer databases across dependency rounds creates shared-cache and process-lifetime interactions that require maintainer review.

No open issues 🎉

Review effort: Max (adaptive)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants