Hacker News new | ask | show | jobs
by AdieuToLogic 375 days ago
A way to ensure the zsh invocation behaves as a typical interactive shell is:

  time zsh --login -c 'logout'
Note use of logout instead of exit. In this context, logout ensures whatever combination of flags used results in a login shell.

See zshbuiltins(1).

1 comments

On par with the first time.

  $ time zsh --login -c 'logout'
  zsh --login -c 'logout'  0.03s user 0.01s system 99% cpu 0.037 total
Whenever I've had noticeably slow zsh startup times in the past, it was almost always some plugin/extension doing something very dumb (e.g. stuff like full 'git status' in a large repo -- just takes time); not the history management.
> On par with the first time.

This was my experience as well. The --login flag was recommended in order to address concerns raised by @abathur.

> Whenever I've had noticeably slow zsh startup times in the past, it was almost always some plugin/extension doing something very dumb (e.g. stuff like full 'git status' in a large repo -- just takes time); not the history management.

Great point.

Unfortunately, my limited research suggests tracking down which plugin or extension is the root cause is a manual effort starting with the contents of the canonical zsh initialization files (often named .zlogin, .zprofile, .zshenv, and .zshrc).

nvm plugin used to be really bad!

i think you can debug-trace loading time putting some commands on your zshconfig