$ time zsh -i -c 'exit'
zsh -i -c 'exit' 0.03s user 0.02s system 100% cpu 0.055 total $ time zsh -i -c 'exit'
zsh -i -c 'exit' 0.03s user 0.02s system 100% cpu 0.055 total $ time zsh
$ ^D
zsh 0.14s user 0.04s system 80% cpu 0.219 total
It's just not an obstacle to spawning a new shell and using it. 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).
$ 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.i think you can debug-trace loading time putting some commands on your zshconfig
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).
I mean, this might seem really bizarre to worry about, but some folks use tiling window managers and just expect to immediately start typing once the “new terminal” key is hit…
Actually this has been slightly annoying me lately after making my system pretty. I added some fancy compositor stuff and now if I do “open terminal,” “exit” the computer complains that it doesn’t know what xit means. Not a big enough problem to fix though.
Edit: huh, actually playing with it this seems to be 99% the fault of the terminal emulator anyway, not the shell or my silly special effects.
Unless the system is under memory pressure, most shell initialization will read from in-memory OS file caches and not be noticeable as you note.
Where significant delays are often seen is when a seemingly innocuous extension uses network-based or some other heavy file system I/O commands (such as a "find $HOME -type f" type of thing).
* Load asynchronously
* Only have a barrier if I reverse-search.
Might be over-engineered, though.
time zsh -i -c 'exit'
zsh -i -c 'exit' 0.33s user 0.31s system 97% cpu 0.658 total
Yeah... I've definitely got something going on here.