Skip to content

Optimize TypeScript code graph performance - #200

Merged
forhappy merged 1 commit into
mainfrom
codex/optimize-code-graph-performance
Aug 8, 2026
Merged

Optimize TypeScript code graph performance#200
forhappy merged 1 commit into
mainfrom
codex/optimize-code-graph-performance

Conversation

@forhappy

@forhappy forhappy commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Reuse a scoped preorder traversal and lexical indexes across TypeScript/JavaScript evidence passes.
  • Avoid repeated resolver scans and skip JavaScript/framework resolution work when no relevant evidence exists.
  • Fix AST fact-digest convergence and parallelize digest generation at the measured crossover.
  • Use native atomic file copies for root artifact projection while preserving immutable snapshots.
  • Add focused regression coverage and opt-in internal profiling boundaries.

Why

TypeScript/JavaScript code-graph builds spent substantial time repeating whole-tree traversals, linearly scanning evidence collections, and streaming immutable artifacts back to the root output. The fact-digest fixed-point loop also compared the wrong values, causing unnecessary work for nested scopes.

Impact

Published graph semantics and hashes remain unchanged for the qualified Axios and date-fns projects. Representative local runs improved, but the strict 2× performance target was not reached; this PR intentionally preserves exact graph output rather than changing the output contract.

Validation

  • cargo fmt --all -- --check
  • git diff --check
  • sh scripts/check_product_boundary.sh
  • CARGO_TARGET_DIR=/Volumes/Workspace/crabbuild-target/compass-42e2-performance cargo test -p compass-languages --test typescript_universal_candidate --locked — 113 passed
  • Earlier focused resolver, framework, file-publication, digest, and Clippy checks passed.
  • Axios and date-fns graph hashes matched their pre-change baselines exactly.

@forhappy
forhappy marked this pull request as ready for review August 8, 2026 14:47
@forhappy
forhappy merged commit 37d1114 into main Aug 8, 2026
10 of 14 checks 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