perf(conf.d): cut shell startup latency by ~30% #130

Merged
rootiest merged 16 commits from perf/startup-latency into main 2026-09-08 05:30:06 +00:00
16 Commits
Author SHA1 Message Date
rootiest 43752aa268 Merge remote-tracking branch 'origin/main' into perf/startup-latency
# Conflicts:
#	tests/functional.fish
2026-09-08 01:28:27 -04:00
rootiest 53b353eb7f test: assert conf.d stays lazy in non-interactive shells
Spawns one non-interactive child against the sandboxed config and asserts on
what loaded -- abbreviations, key bindings, bang-expansions, the C5 event
handlers and the tailscale completion machinery must all be absent. Exit
codes name which guard regressed. No wall-clock assertions, so it cannot
flake.
2026-09-07 20:04:47 -04:00
rootiest d49d90a2de chore(docs): regenerate manual
docs/fish-config.1 is left for CI to regenerate: the local pandoc is 3.10.2
against CI's 3.1.3, so rebuilding it here emits ~4700 lines of formatter
churn unrelated to this change. The component registry rebuilt identically.
2026-09-07 20:01:24 -04:00
rootiest 85c753aaa6 docs: point tailscale and cheat completions at completions/
Follows the relocation out of conf.d/. The completions/ branch of the file
tree is expanded from the real directory at build time, so it needs no
hand-written children. Generated docs are regenerated separately.
2026-09-07 19:59:53 -04:00
rootiest 52711a42a2 perf(conf.d): skip paru/yay wrapper generation in non-interactive shells
Neither file defines a function or sets a global; their only effect is
writing ~/.local/bin/<tool>, which every interactive session does anyway.
Combined 10.7 ms off every fish -c.
2026-09-07 19:58:10 -04:00
rootiest c998d1b8d7 perf(conf.d): skip C5 logging sync in non-interactive shells
__fish_config_sync_logging ran on every fish -c, mkdir+touching the C5
sentinel on disk from every subshell. Its consumers — the Kitty watcher and
the paru/yay wrappers — are interactive-context, and every interactive shell
still reconciles the state.
2026-09-07 19:56:45 -04:00
rootiest 5fa849fd81 perf(conf.d): skip wakatime hook in non-interactive shells
fish_postexec is emitted only by the interactive reader (verified), so the
handler could never fire in a script. No telemetry behaviour changes.
2026-09-07 15:00:57 -04:00
rootiest 2edea59ca3 perf(conf.d): skip auto-pull handler in non-interactive shells
The --on-variable PWD handler backgrounds a git fast-forward. A script that
cd's was firing it, which is also where AGENTS.md Task #4's credential
prompt could surface from a background job.
2026-09-07 15:00:01 -04:00
rootiest 5edfb5b720 perf(conf.d): skip theme colors in non-interactive shells
fish_color_* is consumed only by the syntax highlighter. The guard sits
below the existing cleanup branch so stale-FZF_DEFAULT_OPTS cleanup keeps
running where it does today; the FZF value itself is a persisted universal
and survives regardless.
2026-09-07 14:59:10 -04:00
rootiest 4d6b99fb28 perf(conf.d): skip starship.fish in non-interactive shells
Defines fish_prompt only. The guard precedes the op-guard and the type -q
PATH scan so both are skipped in scripts. Scripts fall back to the repo's
autoloadable functions/fish_prompt.fish, which nothing invokes anyway.
2026-09-07 14:58:18 -04:00
rootiest bb5b6b361a perf(conf.d): skip key_bindings.fish in non-interactive shells
fish_user_key_bindings is invoked only by the interactive reader.
2026-09-07 14:57:02 -04:00
rootiest 13d415db2b perf(conf.d): skip bash_expands.fish in non-interactive shells
The six expand_* functions are only ever reached through abbr --function,
which fires during interactive expansion.
2026-09-07 14:56:16 -04:00
rootiest c3a2b6fa0c perf(conf.d): skip abbr.fish in non-interactive shells
61 abbreviations were declared on every fish -c. Abbreviations expand only
in the line editor, so nothing outside an interactive session can use them.
2026-09-07 14:55:31 -04:00
rootiest 3d8d6a4468 refactor(conf.d): move cheat completions to completions/
Thirteen lines, every one a `complete -c cheat` registration, sourced on
every shell start from the wrong directory. Startup cost was already ~0
because its command substitutions are lazy, but completions/ is where fish
expects the file and the move is free.
2026-09-07 14:54:38 -04:00
rootiest fb21fa550a perf(completions): drop tailscale self-priming completion call
The Cobra-generated block ran `complete --do-complete "tailscale "` to flush
pre-existing completions before erasing them, which executed the tailscale
binary. From completions/ it has no job: fish autoloads only the first match
on $fish_complete_path and the repo's completions/ precedes the vendor dir,
so the vendor file is never sourced.

Verified byte-identical completion output across four probes with the vendor
file present. A comment at the deletion site records the reasoning.
2026-09-07 14:53:35 -04:00
rootiest 321b80f1f8 perf(conf.d): load tailscale completions lazily from completions/
conf.d/tailscale.fish is 252 lines of Cobra-generated completion that fish
sourced on every shell start, and its self-priming block executed the
tailscale binary to warm the completion cache. completions/ is the directory
fish autoloads on first <TAB>.

Measured: 19.2 ms off both interactive and non-interactive startup.
2026-09-07 07:32:03 -04:00