Problem: Every new terminal and tmux pane took ~2.5 seconds to show the prompt. With 100–200 windows/panes opened per day in my terminal-native workflow, that's 4–8 minutes of waiting daily. I'd tolerated it because my .zshrc hadn't been meaningfully touched since 2010 and I wasn't eager to dive into that project.
Fix: Fed my .zshrc to an LLM and asked it what's wrong. It immediately flagged nvm loading synchronously on every shell start. Lazy-loading nvm dropped the shell startup from 2.5s → 0.08s.
lazy_load_nvm() {
unset -f nvm node npm npx
[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"
}
nvm() { lazy_load_nvm; nvm "$@"; }
node() { lazy_load_nvm; node "$@"; }
npm() { lazy_load_nvm; npm "$@"; }
npx() { lazy_load_nvm; npx "$@"; }
Spent about 20 more minutes to understand and modernize the rest of the config.
Time saved: ~2.4s per startup × 100–200 startups/day = ~4–8 minutes/day.
Time invested: 25 minutes. Payback period: ~5 days.
On backlog: ~3 months (the slowdown since installing nvm); over a decade for the .zshrc cleanup.