Skip to content

perf(picker): accelerate large workspace file searches - #298

Merged
fcoury-oai merged 1 commit into
mainfrom
fcoury/file-picker-performance
Aug 21, 2026
Merged

perf(picker): accelerate large workspace file searches#298
fcoury-oai merged 1 commit into
mainfrom
fcoury/file-picker-performance

Conversation

@fcoury-oai

Copy link
Copy Markdown
Collaborator

Why

The file picker rescored every workspace file after every keystroke. In large repositories, broad path prefixes keep thousands of candidates alive and make typing noticeably sluggish.

What changed

  • Reuse the previous result set when a file-picker query narrows, and invalidate that cache when the query broadens or the available files change.
  • Score candidate sets of at least 1,024 files in parallel with Rayon while preserving existing fuzzy scores, tie-breakers, and stable result ordering.
  • Reject paths that cannot contain the requested fuzzy subsequence before invoking the more expensive matcher.
  • Add an opt-in, five-sample performance benchmark that supports both a real workspace and a portable 12,000-file fixture.
  • Add focused regressions for incremental narrowing, backspacing, replaced file lists, and stable ordering on large parallel-filtered sets.

Median filtering time for the codex-rs/core/src query in an optimized build:

Workspace Files Before After Improvement
Real Codex checkout 6,415 106.7 ms 22.8 ms 4.7x
Synthetic fixture 12,000 100.3 ms 19.5 ms 5.1x

How to Test

  1. Run cargo test -p red --lib ui:: -- --test-threads=1; all 345 UI tests should pass, including the large-list ordering and query-broadening regressions. The manual benchmark remains ignored during normal runs.
  2. Run RED_FILE_PICKER_BENCH_ROOT=/path/to/large/workspace cargo test --release -p red --lib file_picker_large_workspace_performance -- --ignored --nocapture; the benchmark should report five-sample medians for discovery, installation, keystrokes, filtering, and drawing. Omit the environment variable to exercise the portable 12,000-file fixture.
  3. Open the file picker in a large repository, type a multi-character filename or path query, then backspace and change the query; results should remain responsive, correctly ranked, and include files that become eligible again.

Also verified with cargo clippy --all-targets --all-features -- -D warnings.

@fcoury-oai
fcoury-oai merged commit e0b3093 into main Aug 21, 2026
13 checks passed
@fcoury-oai
fcoury-oai deleted the fcoury/file-picker-performance branch August 21, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant