Skip to content

fix(resolve): avoid cloning snapshot nodes during resolution - #242

Merged
sunerpy merged 1 commit into
mainfrom
codex/resolve-shared-snapshot-nodes
Aug 27, 2026
Merged

fix(resolve): avoid cloning snapshot nodes during resolution#242
sunerpy merged 1 commit into
mainfrom
codex/resolve-shared-snapshot-nodes

Conversation

@sunerpy

@sunerpy sunerpy commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • keep one canonical Arc<Node> per snapshot node and share it across name, file, kind, and id indexes
  • add backward-compatible shared-node lookup methods to ResolutionContext and switch hot resolver, framework, import, and name-matching paths to them
  • preserve deterministic candidate ordering and the existing Vec<Node> compatibility surface

Performance evidence

  • focused resolution benchmark: 65.92s -> 4.60s wall time (14.3x faster), 773.71s -> 0.44s system CPU, and 5.47m -> 59k minor faults
  • release binary cold codegraph init on /config/workspace/ProdDir/vscode: 13,568 files, 375,287 nodes, and 1,693,459 edges in 6m30.69s
  • before/after graph exports were byte-identical (about 24 MiB)

Validation

  • make ci
  • cargo build --release -p codegraph-rs
  • real VS Code cold index rebuild with the release binary

@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.34426% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/codegraph-resolve/src/import_resolver.rs 95.91% 2 Missing ⚠️

Impacted file tree graph

@@           Coverage Diff            @@
##             main     #242    +/-   ##
========================================
  Coverage   95.36%   95.36%            
========================================
  Files         141      141            
  Lines       79452    79602   +150     
========================================
+ Hits        75767    75915   +148     
- Misses       3685     3687     +2     
Files with missing lines Coverage Δ
crates/codegraph-resolve/src/context.rs 98.58% <100.00%> (+0.10%) ⬆️
crates/codegraph-resolve/src/frameworks/godot.rs 87.69% <100.00%> (+0.10%) ⬆️
crates/codegraph-resolve/src/frameworks/nestjs.rs 98.99% <100.00%> (ø)
crates/codegraph-resolve/src/frameworks/react.rs 95.00% <100.00%> (ø)
crates/codegraph-resolve/src/frameworks/tauri.rs 93.17% <100.00%> (ø)
crates/codegraph-resolve/src/frameworks/vue.rs 99.35% <100.00%> (ø)
crates/codegraph-resolve/src/name_matcher.rs 97.59% <100.00%> (+<0.01%) ⬆️
crates/codegraph-resolve/src/resolver.rs 97.14% <100.00%> (+<0.01%) ⬆️
crates/codegraph-resolve/src/snapshot_context.rs 98.02% <100.00%> (+0.17%) ⬆️
crates/codegraph-resolve/src/types.rs 100.00% <100.00%> (ø)
... and 1 more

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sunerpy
sunerpy merged commit fe9f0a7 into main Aug 27, 2026
7 checks passed
@sunerpy
sunerpy deleted the codex/resolve-shared-snapshot-nodes branch August 27, 2026 10:40
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