perf(filesearch): make file search opt-in and bound the fd walk #9

Merged
vikingowl merged 2 commits from feat/filesearch-gating into main 2026-06-01 16:57:26 +02:00
Owner

Problem

File search shelled out to fd/locate on every auto-mode keystroke, walking $HOME and 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 target was instant, bare target was 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() (default true); filesearch returns false, so it only runs when its :file prefix is active — never on a bare auto-mode query.
  • Route / as a :file prefix alias in parse_query (identical ParsedQuery).
  • Drop the colon-less file /find auto-triggers — :file / / cover it (also fixes :file find me searching for "me").
  • Bound fd: --max-depth, --exclude .git/node_modules/target/.cache, 20 results, 750ms kill-timeout (spawn + drained stdout + reap).
  • Configurable 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

  • 14 new tests: manager-level auto-mode gating (spy DynamicProvider), / alias parse, bounded fd_args, expand_tilde/resolve_roots, lua merge round-trip.
  • cargo test green on --features full (370 lib), --no-default-features, and --no-default-features --features lua; clippy clean on all.

Commits

  1. perf(filesearch) — the fix + feature.
  2. chore(ui) — startup + search latency timing behind RUST_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.

## Problem File search shelled out to `fd`/`locate` on **every auto-mode keystroke**, walking `$HOME` and 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 target` was instant, bare `target` was 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()` (default `true`); filesearch returns `false`, so it only runs when its `:file` prefix is active — never on a bare auto-mode query. - Route `/` as a `:file` prefix alias in `parse_query` (identical `ParsedQuery`). - Drop the colon-less `file `/`find ` auto-triggers — `:file` / `/` cover it (also fixes `:file find me` searching for "me"). - Bound `fd`: `--max-depth`, `--exclude .git/node_modules/target/.cache`, 20 results, 750ms kill-timeout (spawn + drained stdout + reap). - Configurable `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 - 14 new tests: manager-level auto-mode gating (spy `DynamicProvider`), `/` alias parse, bounded `fd_args`, `expand_tilde`/`resolve_roots`, lua merge round-trip. - `cargo test` green on `--features full` (370 lib), `--no-default-features`, and `--no-default-features --features lua`; `clippy` clean on all. ## Commits 1. `perf(filesearch)` — the fix + feature. 2. `chore(ui)` — startup + search latency timing behind `RUST_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.
vikingowl added 2 commits 2026-06-01 16:57:02 +02:00
File search shelled out to `fd`/`locate` on every auto-mode keystroke,
walking $HOME and serialising behind a single daemon connection — observed
0.9–1.3s per keystroke, stalling every other provider's results. Gate it
behind explicit intent and bound the walk.

- DynamicProvider::runs_in_auto_mode() (default true); filesearch returns
  false, so it only runs when its `:file` prefix is active — never on a
  bare auto-mode query
- route `/` as a `:file` prefix alias in parse_query (identical ParsedQuery)
- drop the colon-less `file `/`find ` auto-triggers; `:file` / `/` cover it
  (also fixes `:file find me` searching for "me")
- bound fd: --max-depth, --exclude .git/node_modules/target/.cache,
  20 results, 750ms kill-timeout (spawn + drained stdout + reap)
- configurable providers.filesearch_roots (TOML + owlry.set; `~/` expanded,
  non-existent entries dropped); empty searches $HOME

Auto-mode typing drops from up to 1.3s to ~2–20ms; file search stays one
keystroke away.
Phase deltas across activation (boot → activate → present → first paint)
in app.rs, and per-query dispatch→IPC→paint timing in the keystroke search
path, to localise launcher latency in the field. Gated behind debug log
level via `log::debug!`; no cost in normal runs.
vikingowl merged commit d04375c967 into main 2026-06-01 16:57:26 +02:00
vikingowl deleted branch feat/filesearch-gating 2026-06-01 16:57:52 +02:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Owlibou/owlry#9