perf(filesearch): make file search opt-in and bound the fd walk #9
Reference in New Issue
Block a user
Delete Branch "feat/filesearch-gating"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
File search shelled out to
fd/locateon every auto-mode keystroke, walking$HOMEand serialising behind the single daemon connection. Measured 0.9–1.3s per keystroke, with slow queries stalling every other provider's results (and getting discarded as stale). Confirmed on a user's system::app targetwas instant, baretargetwas seconds — isolating it to filesearch.Instrumentation also showed first-open lag is a separate concern (GTK process cold-start, not the daemon); that's untouched here.
Change
Make file search opt-in and bound the walk:
DynamicProvider::runs_in_auto_mode()(defaulttrue); filesearch returnsfalse, so it only runs when its:fileprefix is active — never on a bare auto-mode query./as a:fileprefix alias inparse_query(identicalParsedQuery).file/findauto-triggers —:file//cover it (also fixes:file find mesearching for "me").fd:--max-depth,--exclude .git/node_modules/target/.cache, 20 results, 750ms kill-timeout (spawn + drained stdout + reap).providers.filesearch_roots(TOML +owlry.set;~/expanded, non-existent entries dropped); empty searches$HOME.Result: auto-mode typing drops from up to 1.3s to ~2–20ms; file search stays one keystroke away.
Tests
DynamicProvider),/alias parse, boundedfd_args,expand_tilde/resolve_roots, lua merge round-trip.cargo testgreen on--features full(370 lib),--no-default-features, and--no-default-features --features lua;clippyclean on all.Commits
perf(filesearch)— the fix + feature.chore(ui)— startup + search latency timing behindRUST_LOG=debug(droppable if not wanted permanently).Not included
Repo-wide rustfmt drift (no
rustfmt.toml; committed code is dirty vs rustfmt 1.9.0) is intentionally left alone — best handled as its own pinned normalization PR.