1

I'm using prezto with zsh, and find it a little slow to launch a new shell. (N.B. I'm attempting to optimise on a fast-ish system, before moving my configuration to other, slower systems.)

Benchmarking with time zsh -i -c exit:

  • 0.046: bash.
  • 0.080: zsh without prezto.
  • 0.092: zsh with prezto, but no modules loaded.
  • 0.138: zsh with prezto, and all "default" modules loaded, except for completion.
  • 0.308: zsh with prezto, and all "default" modules loaded.

Firstly, zsh is 74% slower than bash to load. I could accept the further 73% slowdown (with prezto and all modules except completion loaded), but the 285% slowdown (with all modules) is a bit too much.

Some of these completions are useful, so is there a way to selectively disable some of these? I've heard mention of this elsewhere, although I'm not sure if this is only to improve tab-completion speed, or shell loading as well. (If I could selectively disable completion, this would allow me to profile and work out what was causing the slowdowns.)

Sparhawk
  • 19,561
  • 18
  • 86
  • 152

1 Answers1

2

It seems that prezto is loading the module from /usr/lib/prezto/modules/completion. With everything enabled, I deleted the contents of /usr/lib/prezto/modules/completion/init.zsh, which gave me the second quickest load time again. I then started systematically deleting lines in this file, and could isolate a single line causing the slowdowns.

unsetopt CASE_GLOB

N.B. in my specific case, the slowdown was caused by a duplicate compinit in my ~/.zshrc. Presumably prezto was also running compinit with case off, resulting in a two-fold increase in load time.

Sparhawk
  • 19,561
  • 18
  • 86
  • 152