▲ | klibertp 4 days ago | ||||||||||||||||
It takes 3.5 seconds for a new login shell to open on my laptop, which has a decent CPU and a fast SSD. I do have quite a few lines of config, but no oh-my-zsh and almost no plugins. I have around 2k SLOC of ZSH config. Meanwhile, I have 22.3k SLOC of Emacs Lisp config, and Emacs starts up (granted, after lowering bytecode to native code AOT) in ~4 seconds. To me, that suggests there's something really wrong with ZSH in terms of performance - unfortunately, it's better in almost every other way compared to BASH, so I learned to live with that. Still, at least in my setup, ZSH indeed is slow, even on modern hardware. I wonder if it would even run on a 486... | |||||||||||||||||
▲ | cb321 4 days ago | parent [-] | ||||||||||||||||
That sounds way too long. Mine takes like 15 ms on a 2015 cpu and I activate zsh-syntax-highlighting and new style completion and everything, but yeah oh-my-zsh often adds nutso overhead. Anyway, I suggest you profile your zsh start-up. Here's one copy-paste friendly way to do that:
(Note for $EPOCHREALTIME to work you need a `zmodload zsh/datetime` somewhere early on. I might suggest at the top of `$ZDOTDIR/.zshenv` for this kind of thing.)Also, if something seems limited by "just parsing", you can usually speed that up a lot with `zcompile`. I do that with a `.zcompdump.zwc` and a `digraphs.zsh.zwc`. EDIT: I noticed myself that really large HISTSIZE (in the 100s of thousands, and with such limit realized) combined with de-duplication seems to be a bad combination. I just lowered my HISTSIZE with a when-too-big spool-off for longer term history/cold storage. | |||||||||||||||||
|