Repository navigation
perf(wsl): search Windows-drive projects with host ripgrep - #27690
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to No actionable merge-blocking issue is established. Normal checks remain appropriate before merging. Pre-merge checks |
|
A project stored on a Windows drive (C:\...) with the WSL runtime selected ran quick open, file-path search, content search and Markdown listing through wsl.exe and the Linux rg reading /mnt/c over drvfs. rg only reads files, so it has no git index whose stat cache two writers could thrash; the host binary reads NTFS directly. Measured on a 21.6k-file clone on C: (Windows 11, Ubuntu-24.04): content search WSL rg 3.5 s -> host rg.exe 0.19 s file listing WSL rg 0.14 s + ~65 ms wsl.exe spawn -> host 0.03 s Git routing is intentionally unchanged: alternating Windows git and WSL git on the same index forced a full ~250 s rehash on the next WSL git status. WSL UNC roots and non-drive roots keep their existing routing.
…exist Windows rg cannot open a 'nul' file, Win32-trimmed names, or WSL-created symlinks; treat those per-file errors as skipped rather than failing or truncating the search, and keep symlink-following scans in WSL.
dc8e0f7 to
1130b65
Compare
ELI5
When a project lives on a Windows drive (like
C:\code\app) but you picked WSL as its runtime, Orca's file search used to reach the files from inside Linux, through a slow bridge. Now search reads them directly from Windows, which is much faster and returns the same results.What Changed
rginside WSL viawsl.exe, reading the project over/mnt/c.rgon the host. Results are the same; searches finish much sooner.resolveBundledRipgrepWslRouting(src/main/ripgrep/bundled-ripgrep-wsl-routing.ts) chooses wherergruns from the root path. Everyrgcaller uses it. Drive-letter roots stay on the host;\\wsl.localhost\...roots still run inside their distro, as before.Why
Reading NTFS through WSL's drive mount is slow, and every search also pays the
wsl.exestartup cost.rgonly reads files, so which side runs it doesn't affect anything else.We did not move git as well. We measured that alternating Windows git and WSL git on the same repo invalidates the index stat cache: the next WSL
git statustook ~250 s after Windows git rewrote the index. Repos checked out by Windows git withcore.autocrlf=truealso show ~21k false "modified" files to WSL git. Moving git needs its own user-facing design.Known differences: host
rgrespects the Windows user's global gitignore instead of the WSL one, and symlinks created from WSL on the drive may not resolve for Windowsrg.Linked Issue
Part of #9300. Related: #9284 (its git part is not addressed here).
Visual Proof
N/A. The UI is unchanged and the results are identical; only speed changes (see Testing).
Testing
Real Windows 11 + WSL host, 21,645-file clone on
C::rg(before)rg(after)wsl.exestartupLocal (macOS):
pnpm tc,pnpm test src/main/ripgrep src/main/ipc src/main/providers src/main/runtime,oxlint+oxfmt --checkon changed files, andpnpm run check:code-quality:changedall pass. I updated the runtime search test so it covers both a drive root (hostrg) and a\\wsl.localhostroot (WSLrg).AI Disclosure
Review
Agent skill upstream boundary
Notes
SSH and non-Windows hosts are unaffected: the routing only changes for local Windows drive-letter roots. Folder workspaces and git worktrees take the same path. No wire changes.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)