Speed up cold indexing by 5–11x with adaptive context#162
Open
cktang88 wants to merge 2 commits into
Open
Conversation
cktang88
marked this pull request as ready for review
July 23, 2026 20:34
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.
Impact
Cold indexing becomes 5.3x faster on React and 11.3x faster on a large private repository on an Apple M4 Pro with 48 GB RAM, while peak memory falls by 67–73%.
This revision replaces the earlier fixed 64-token policy with adaptive, structure-aware context budgets. That recovers substantially more retrieval quality, but the benchmark results below also show that the speedup is not quality-neutral on every workload.
What changes for users
@floware parsed with the existing TSX grammar so typed functions remain coherent units.COLGREP_INDEX_DOCUMENT_LENGTH=0restores the model-native context. A positive value forces a fixed limit. Custom models continue to use their native limit by default.Cold-index benchmarks
Release binaries used the same base commit, cached model, CPU INT8 inference, CoreML + Accelerate support, 14 ONNX sessions, and isolated cold index directories.
React
Pinned at
react/react@28cd4bb, indexing the same 6,959 files:mainPrivate large repository
Both runs indexed the same 10,406 files:
mainOnly aggregate measurements are reported; no proprietary source, paths, fixtures, query text, or repository-specific behavior is included.
Retrieval evaluation
The evaluation uses 100 recent non-merge commit subjects as queries and treats files changed by the corresponding commit as relevant. Searches use
--files-only -k 10. This is a reproducible proxy for code-search usefulness, not a human relevance judgment.React
mainmainDefault/hybrid search improves at every cutoff. Semantic-only search improves Recall@1 and MRR but loses 4 points at Recall@5 and 3 points at Recall@10.
Private large repository
mainmainThe private workload shows a modest default/hybrid regression and a material semantic-only regression. The native-context environment override remains available, but reviewers should treat this PR as an explicit performance/quality tradeoff rather than a claim of universal quality parity.
Why cold builds were slow
Three costs compounded:
GPU/SIMD changes were not the primary lever on this workload: eliminating repeated index construction, thread oversubscription, fragmented units, and unnecessary transformer context produced the measured gains while retaining the existing cross-platform inference path.
Manual QA