perf: parallel indexing, embedding cache, HNSW ANN, lazy imports#100
Merged
Conversation
- Parallel file indexing with concurrency-limited embedding (Fix 1) - Content-hash embedding cache (persists to ~/.champ/embed-cache/) (Fix 2) - Tool result truncation 500→3000 chars with first/last preservation (Fix 3) - Parallel independent (read-only) tool calls in tool-calling loop (Fix 4) - Lazy dynamic imports for IndexingService, MultiAgentRunner, TeamMarketplaceClient (Fix 5) - HNSW ANN vector index for stores >10K entries (Fix 6) - Smart router dedup: array→Map, eliminates 3 redundant passes (Fix 7) - Response cache wired into ToolCallingLoop for team-agent flows (Fix 8) - Documented tree-sitter chunking path (Fix 9)
…itions Critical fixes: - Embedding cache: add LRU eviction (10K cap) to prevent OOM on large workspaces - Embedding cache: binary disk format with dimension validation - VectorStore: replace Function() constructor with standard import() (CSP-safe) - VectorStore: add version counter to prevent HNSW label desync during async build - IndexingService: await saveIndex/saveCache to prevent races with dispose() - IndexingService: convert collectFiles to async (remove readFileSync) - Extension: add generation counter to prevent orphaned IndexingService - ToolCallingLoop: use actual provider/model names in response cache namespace
) - Wrap background init block in 10s Promise.race to prevent indefinite hangs - Broadcast state: 'error' on timeout so webview shows feedback - Add providerLoadInFlight mutex to deduplicate concurrent loadProvider calls - Parallelize 3 sequential context.secrets.get() calls via Promise.all - Add 'reloadProvider' message type and handler in ChatViewProvider - Add retry button in header error state (main.js + main.css)
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
Addresses 6 performance bottlenecks in the Champ VS Code extension codebase, plus a full review pass fixing 9 additional issues (race conditions, CSP violations, OOM risks).
Changes
Core optimizations (commit
dccd00b)Promise.allSettled()with 6-concurrency limiter inindexing-service.tsMap<sha256, Float32Array>+ disk persistence inembedding-service.tstruncateForMetrics()intool-calling-loop.tsPromise.allSettled()for read-only toolsimport()forIndexingService,MultiAgentRunner,TeamMarketplaceClientinextension.tshnswlib-nodewith brute-force fallback for >10K entries invector-store.tsmergeModels()insmart-router.tsToolCallingLoopfor team-agent flowsReview fixes (commit
dd37293)void this.saveIndex()/saveCache()await Promise.allSettled()before returnreadFileSyncblocks event loop in parallel workersawait fsp.readFile()+ asyncreaddirFunction()constructor violates CSPimport("hnswlib-node")vec.lengthonChangeorphans IndexingServicetool-loop/default)provider.name+config.modelVerification
Checklist
readFileSyncin async code pathsFunction()constructor (CSP-safe)