mirror of
https://github.com/Xevion/dotfiles.git
synced 2025-12-17 14:11:45 -06:00
perf: optimize shell startup with batched PATH operations and Homebrew caching
- Batch Fish PATH additions into single operation (reduces startup by ~13ms) - Cache Homebrew shellenv output for 7 days (reduces startup by ~14ms) - Update CLAUDE.md with TODO list update workflow guidelines - Change default chezmoi cd shell from bash to fish - Remove redundant bun completion sourcing in bash Performance improvements measured through shell startup profiling.
This commit is contained in:
@@ -28,7 +28,23 @@ if [ -d "$HOME/.deno" ]; then
|
||||
. "$HOME/.deno/env" # Deno
|
||||
fi
|
||||
. "$HOME/.cargo/env" # Rustup + Cargo + Cargo-installed tools
|
||||
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" # Brew
|
||||
|
||||
# Homebrew (cached for performance - reduces startup time by ~14ms)
|
||||
if [ -f /home/linuxbrew/.linuxbrew/bin/brew ]; then
|
||||
BREW_CACHE="$HOME/.cache/brew_env.sh"
|
||||
BREW_BIN="/home/linuxbrew/.linuxbrew/bin/brew"
|
||||
|
||||
# Regenerate cache if: doesn't exist, >7 days old, or brew binary is newer
|
||||
if [ ! -f "$BREW_CACHE" ] || \
|
||||
[ $(( $(date +%s) - $(stat -c %Y "$BREW_CACHE" 2>/dev/null || echo 0) )) -gt 604800 ] || \
|
||||
[ "$BREW_BIN" -nt "$BREW_CACHE" ]; then
|
||||
mkdir -p "$(dirname "$BREW_CACHE")"
|
||||
"$BREW_BIN" shellenv > "$BREW_CACHE" 2>/dev/null
|
||||
fi
|
||||
|
||||
[ -f "$BREW_CACHE" ] && . "$BREW_CACHE"
|
||||
fi
|
||||
|
||||
command -v rbenv &> /dev/null && eval "$(rbenv init -)" # rbenv for Ruby
|
||||
command -v chatgpt &> /dev/null && . <(chatgpt --set-completions {{ .shell -}}) # chatgpt completions
|
||||
{{ if eq .shell "bash" -}}
|
||||
@@ -50,7 +66,6 @@ fi
|
||||
# bun
|
||||
export BUN_INSTALL="$HOME/.bun"
|
||||
export PATH="$BUN_INSTALL/bin:$PATH"
|
||||
[ -s "$HOME/.bun/_bun" ] && source "$HOME/.bun/_bun"
|
||||
|
||||
# java version manager
|
||||
if [ -d $HOME/.jenv/bin ]; then
|
||||
|
||||
Reference in New Issue
Block a user