Perf: reduce initial full-index extraction and reference work - #5386
Merged
Merged
Conversation
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
Initial full indexing repeatedly evaluates impossible declaration regexes, resolves identical reference sources, and scans unrelated same-name symbols or earlier occurrences on dense lines. These changes reduce that work while preserving the logical index contents and existing resolution rules.
Performance and compatibility
The benchmark uses the fixed
a33c5a8ebsource snapshot: 1,577 files, 59,387 symbols and 562,615 references. Each version was measured twice on macOS ARM64, Release .NET 8, with a new database and--parallelism 2 --memory-trace; heavy tests were stopped during measurement.8533dff4fEach percentage describes its own measurement session. The second comparison reduced total managed allocations from 8.09–8.10 GB to 7.48 GB (about 8%); the first comparison increased allocations from 7.93–7.96 GB to 8.10 GB.
All runs completed without warnings, errors or extraction cap hits. Logical file, chunk, symbol, reference-line, issue, reference and resolution-candidate records match after normalizing generated IDs and indexing timestamps. The fixture is C#-heavy; these measurements are not a general speed guarantee. Scoped candidate seeks add a small fixed cost for unique names or names already confined to eligible scopes; the measured tradeoff is documented.
Validation
8d90c292b:dotnet test CodeIndex.sln -c Release --no-restore -p:UseSharedCompilation=false --settings tests/CodeIndex.Tests/CodeIndex.Tests.runsettings --blame-crash --blame-hang --blame-hang-timeout 5m.git diff --checkpassed.0d3027832:./dev.sh lintpassed (the same script invoked by CI'smake lint), and both affected test classes passed all 57 cases on each of .NET 8 and .NET 9. Independent review confirmed that only test whitespace changed; production code and test semantics are unchanged.origin/main..HEAD:No blocking/actionable issues found.Documentation and changelog
Updated
TESTING_GUIDE.mdand the English/Japanese measurement and compatibility notes in docs/initial-index-performance.md.Bilingual fragments:
changelog.d/unreleased/+initial-index-confirmation-suffixes.changed.mdchangelog.d/unreleased/+initial-index-shared-reference-sources.changed.mdchangelog.d/unreleased/+initial-index-lambda-captures.changed.mdchangelog.d/unreleased/+initial-index-scope-candidate-seeks.changed.mdchangelog.d/unreleased/+initial-index-declaration-punctuation.changed.mdchangelog.d/unreleased/+initial-index-reference-occurrences.changed.mdNo issue auto-close references or separate follow-up candidates are included.