Speed up shell startup 9x (1.9s → 0.2s)
Lazy-load Intel oneAPI setvars.sh (~1.5s) via wrapper functions that source the environment on first use of icc/icx/ifort/etc. Cache all shell completion outputs to ~/.cache/bash.d/ so they are sourced from disk instead of regenerated via subprocess on every shell start. Cache invalidates automatically when the tool binary is updated. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a9875dceec
commit
6a00847d4e
11 changed files with 83 additions and 23 deletions
|
|
@ -35,6 +35,7 @@ Lower numbers load first, so foundational pieces like helper functions (`00-`) a
|
|||
|
||||
- **`00-path-helper`** — Defines `path_append` and `path_prepend` functions that safely add directories to `$PATH` (checking the directory exists and avoiding duplicates).
|
||||
- **`00-credential-guard`** — Defines `require_private`, which warns at shell startup if a credential file has overly permissive permissions (anything beyond owner-only access).
|
||||
- **`00-completion-cache`** — Defines `cached_completion`, which caches shell completion scripts to `~/.cache/bash.d/` so they are only regenerated when the tool binary is updated. Used by all `50-*-completion` scripts.
|
||||
|
||||
### PATH (`10-`)
|
||||
|
||||
|
|
@ -46,7 +47,7 @@ Lower numbers load first, so foundational pieces like helper functions (`00-`) a
|
|||
|
||||
- **`20-android`** — Sets `$ANDROID_HOME`, `$JAVA_HOME`, and adds Android SDK tools to PATH (only when installed).
|
||||
- **`20-ninja`** — Configures Ninja as the default CMake generator and enables ccache for C/C++ builds (only when installed).
|
||||
- **`20-oneapi`** — Sources the Intel oneAPI environment and adds its libraries to `LD_LIBRARY_PATH`.
|
||||
- **`20-oneapi`** — Lazy-loads the Intel oneAPI environment. Because `setvars.sh` takes ~1.5 seconds, the full environment is deferred until an Intel tool (`icc`, `icx`, `ifort`, etc.) is first invoked. Call `_load_oneapi` to trigger it manually.
|
||||
|
||||
### Prompt (`30-`)
|
||||
|
||||
|
|
@ -54,9 +55,14 @@ Lower numbers load first, so foundational pieces like helper functions (`00-`) a
|
|||
|
||||
### Completions (`50-`)
|
||||
|
||||
All completions (except `50-claude-completion`) use `cached_completion` to avoid subprocess overhead on every shell start. Cache files live in `~/.cache/bash.d/` and are automatically regenerated when the tool binary is updated.
|
||||
|
||||
- **`50-asdf-completion`** — Tab completion for the asdf version manager.
|
||||
- **`50-bun-completion`** — Tab completion for Bun (JavaScript runtime & package manager).
|
||||
- **`50-claude-completion`** — Tab completion for [Claude Code](https://claude.com/claude-code) CLI.
|
||||
- **`50-fj-completion`** — Tab completion for the Forgejo CLI (`fj`).
|
||||
- **`50-gh-completion`** — Tab completion for the GitHub CLI (`gh`).
|
||||
- **`50-podman-completion`** — Tab completion for Podman (rootless container engine).
|
||||
- **`50-tailscale-completion`** — Tab completion for Tailscale.
|
||||
- **`50-uv-completion`** — Tab completion for [uv](https://github.com/astral-sh/uv) (Python package manager).
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue