fix(core): avoid eager directory snapshots - #40552
Open
kitlangton wants to merge 2 commits into
Open
Conversation
kitlangton
enabled auto-merge (squash)
August 5, 2026 01:41
kitlangton
disabled auto-merge
August 5, 2026 01:42
kitlangton
enabled auto-merge (squash)
August 5, 2026 01:44
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.
What
Avoid repeatedly rebuilding the filesystem search directory snapshot while ripgrep indexes a repository. Large repositories now pay the directory materialization cost only when a directory or mixed file search is requested.
Before / After
Before: Every indexed file updated the directory
Set, then copied the entire set intostate.directories. As the index grew, per-entry copies accumulated and could produce quadratic allocation and copying work before a user searched.After: Indexing keeps files in an array and unique directories in the existing
Set. File searches read the file array directly; directory and mixed searches materialize the current set at query time, preserving partial results while indexing continues.How
packages/core/src/filesystem/search.tsremoves the eagerly synchronized directory array and reads the live directory set fromfind.Scope
This does not change fuzzy ranking, ripgrep traversal, path formatting, result limits, the optional fff search backend, or existing tests.
Testing
cd packages/core && bun typecheckbun turbo typecheck --concurrency=3