perf: resolve scan/review pipeline performance bottlenecks (P2)#338
Open
ajianaz wants to merge 1 commit into
Open
perf: resolve scan/review pipeline performance bottlenecks (P2)#338ajianaz wants to merge 1 commit into
ajianaz wants to merge 1 commit into
Conversation
Fix 10 performance issues — all 'repeated work in loops' patterns: #41 - Pre-compile regex patterns once per rule instead of per line #5 - Batch DB queries in handle_find_affected_tests (single IN clause) #13 - Batch symbol fetch for Affected command (single query) #14 - Prepare SQL statement once outside test-pattern loop #59 - Early cutoff in secrets scanner when max_findings reached #70 - Break out of all loops when symbol cap hit per file #67 - Cache file reads during sibling search in resolver #3 - Reuse single Tokio runtime for MCP tool calls (static LazyLock) #22 - Static LazyLock regexes in detect_function_entry #24 - Single transaction for prune_deleted instead of per-file Refs #335
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes 10 performance bottlenecks across the scan/review pipeline. All are "repeated work in loops" patterns — the fix is always the same: do it once outside the loop.
Fixes
src/engine/rules/matching.rsensure_compiled()src/mcp/tools.rsINquerysrc/main.rssrc/main.rssrc/engine/secrets_scanner.rssrc/engine/context/extraction.rssrc/engine/context/resolver.rsHashMap<PathBuf, String>cachesrc/mcp/tools.rsLazyLock<Runtime>src/index/extract.rsdetect_function_entrycallstatic LazyLock<Regex>per languagesrc/index/mod.rsTesting
cargo test)cargo clippy)cargo fmt)Refs #335