Skip to content

perf: reuse semantic state for ToolService queries - #423

Merged
Teakowa merged 1 commit into
mainfrom
codex/wright-356-semantic-reuse
Sep 27, 2026
Merged

Teakowa merged 1 commit into
mainfrom
codex/wright-356-semantic-reuse

Conversation

@e54-bot

@e54-bot e54-bot commented Sep 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Reuse the semantic service, symbol index, and findings for the lifetime of a loaded ToolService. A non-default session lint configuration gets its own cached findings while sharing the same index.
  • Build inspect references directly from the index in symbol order, avoiding per-symbol service requests and JSON ID extraction.
  • Extend wright-bench with a recorded repeated-query workload over representative Workshop inputs.

Measurement

The same benchmark harness measured the original no-reuse path before the cache change and the updated path afterward. Each measurement averages 5 trials; each trial repeats the listed 10 operations 5 times after CompilerSession::load(). loadedService includes ToolService::new plus the repeated queries.

Fixture Before After Reduction
synthetic/control-flow 4.52 ms 3.28 ms 27%
synthetic/declarations-rules 3.81 ms 2.67 ms 30%
real-world/overpy-cake 37.49 ms 13.48 ms 64%

The measured sequence is rules, symbols, references(symbol:0), usage(symbol:0), cfg(rule:0), findings, persistentObjects, lint, lintRules, and inspect. The report records this workload in the semantic_queries.workload field.

Validation

  • cargo test --locked --workspace --all-targets --all-features — 260 passed.
  • cargo clippy --locked --workspace --all-targets --all-features -- -D warnings — passed.
  • cargo fmt --all -- --check — passed.
  • cargo run --locked -p wright-bench — passed.

Closes #356

@Teakowa
Teakowa merged commit 9e73de2 into main Sep 27, 2026
22 checks passed
@Teakowa
Teakowa deleted the codex/wright-356-semantic-reuse branch September 27, 2026 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Avoid rebuilding full semantic analysis state for repeated ToolService queries

2 participants