Debugging Shell Startup Performance
It has been a couple of years since I switched from oh-my-zsh to zsh4humans. Since then, I never had to worry about any performance related issues when starting my shell. It always felt instant. Until now.
The Problem
A couple of months ago, I noticed considerable lag when starting a new instance of my shell. I’m not really sensitive to shell startup time, since I’m not a heavy shell user (mostly inside VSCode when coding and sometimes in iTerm to trigger one-off commands or navigate something buried in a hidden folder). But startup times (more specifically, time to first command or first_command_lag
in zsh-bench lingo) measured in seconds instead of milliseconds is too much. So I digged into my ./dotfiles
to find the culprit.