Skip to content

fix(core): avoid eager directory snapshots - #40552

Open
kitlangton wants to merge 2 commits into
v2from
fix-directory-index
Open

fix(core): avoid eager directory snapshots#40552
kitlangton wants to merge 2 commits into
v2from
fix-directory-index

Conversation

@kitlangton

@kitlangton kitlangton commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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 into state.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.ts removes the eagerly synchronized directory array and reads the live directory set from find.

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 typecheck
  • Push hook: bun turbo typecheck --concurrency=3

@kitlangton
kitlangton enabled auto-merge (squash) August 5, 2026 01:41
@kitlangton
kitlangton disabled auto-merge August 5, 2026 01:42
@kitlangton
kitlangton enabled auto-merge (squash) August 5, 2026 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant