Skip to content

perf(editor): accelerate large repository interactions - #332

Merged
fcoury-oai merged 1 commit into
mainfrom
fcoury/large-repo-interaction-performance
Aug 23, 2026
Merged

fcoury-oai merged 1 commit into
mainfrom
fcoury/large-repo-interaction-performance

Conversation

@fcoury-oai

Copy link
Copy Markdown
Collaborator

Why

On repositories with thousands of files, Ctrl-P previously prepared every row and preview path on the editor thread, completion repeatedly scored and allocated across large language-server responses, and visible function-parameter help forced a full terminal redraw for every typed character. Those costs make both file lookup and ordinary function-call editing noticeably uneven.

What changed

  • Prepare file-picker rows on the discovery worker, resolve previews only for the selected file, bound larger preview reads to visible rows, and reject ASCII fuzzy mismatches without character allocations.
  • Cache completion widths and a bounded history of recent filters, parallelize large candidate sets, compute match highlights only for visible rows, and avoid cloning JSON results or completion payloads.
  • Scan buffer-word completions directly across rope chunks while preserving case-insensitive Unicode matching and UTF-16 cursor positions.
  • Keep signature help and floating progress overlays on incremental editor-window rendering, retain full-frame fallback for docked panes, and defer expensive signature-context copies until the debounced request is actually sent.
  • Add reproducible large-repository picker, completion/backspace, buffer-word, and real-LSP signature-help benchmarks with focused regressions.

Measurements

Measured against a Codex checkout containing 6,443 picker-visible files:

Scenario Before After
Ctrl-P UI-thread picker installation 2.97 ms 0.055 ms
Ctrl-P long-path filtering 438 ms 214 ms
18,000 completion candidates, seven-sample median 314 ms 24 ms
Full frames while typing 20 characters with parameter help 22 2

Completion filtering improved by 92%; query-history reuse keeps repeated completion backspaces near 24 microseconds.

How to Test

  1. Build the editor and benchmark example:

    cargo build --all-features --bin red --example performance_hotspots
  2. Exercise both actual terminal interactions against a sibling Codex checkout:

    python3 scripts/interaction_bench.py picker --root ../codex \
      --file ../codex/codex-rs/tui/src/bottom_pane/chat_composer.rs \
      --query chat_composer.rs
    python3 scripts/interaction_bench.py signature --root ../codex \
      --file ../codex/codex-rs/tui/src/bottom_pane/chat_composer.rs

    Expect Ctrl-P to remain responsive while narrowing the path. The signature run should show render:editor_windows for typed characters instead of one render:full per keystroke.

  3. Measure picker installation, large completion lists, backspacing, and large-buffer scans:

    RED_FILE_PICKER_BENCH_ROOT=../codex cargo test --lib file_picker_large_workspace_performance -- --ignored --nocapture
    cargo run --example performance_hotspots -- completion
    cargo run --example performance_hotspots -- completion-backspace
    RED_COMPLETION_BENCH_FILE=../codex/codex-rs/tui/src/bottom_pane/chat_composer.rs cargo run --example performance_hotspots -- buffer-completion
  4. Verify completion acceptance, UTF-16/Unicode handling, and the docked-pane full-redraw regression:

    cargo test --all-features --test completion
    cargo test --lib edited_window_rows
    cargo test --lib buffer_completion_preserves_unicode_casefolding_and_ascii_case

Validated with strict all-target/all-feature Clippy, all 47 completion integration tests, and 2,394 unit tests using four test threads. The unchanged plugin::runtime::tests::git_dashboard_renders_numstat_for_a_large_tracked_file_list stress test times out independently even when run alone and was excluded from the broad local unit run.

@fcoury-oai
fcoury-oai merged commit ae803e0 into main Aug 23, 2026
11 checks passed
@fcoury-oai
fcoury-oai deleted the fcoury/large-repo-interaction-performance branch August 23, 2026 19:57
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