Why oh-my-zsh is that slow?

3

1

I am quite familiar with bash, but I would like to give a try to zsh. Lot of people told me to try oh-my-zsh.

After the installation I get a unreadable prompt and when I eventually find an acceptable prompt it is just very slow. It takes about 300..1000ms for the prompt to display its content. How can I make it faster and how oh-my-zsh users can deal with that?

I've tried it on several platforms (Cygwin, VirtualBox Ubuntu, Debian) and each time I get this very slow behavior.

Can I get rid of it? Is it worth to use zsh despite its speed?

nowox

Posted 2015-11-25T20:25:40.237

Reputation: 1 779

Is zsh only slow when you have the oh-my-zsh enabled? Have you tried zsh all by itself? I don't am not a zsh fan, but have used systems with it as the default shell, and it never seemed significantly slower than bash. I would bet you have some plugin that is doing something that is computationally expensive, or perhaps access the Internet. – Zoredache – 2015-11-25T23:53:59.337

2

Because git (vcs_info) is slow, and many prompts query git status synchronously. Get an async prompt, e.g., pure: https://github.com/sindresorhus/pure.

– 4ae1e1 – 2015-11-30T23:19:11.553

Answers

3

@4ae1e1's comment above should be an answer.

  1. Try to see performance if you type prompt off. This is ugly but if this improves the performance, you know that the prompt is to blame. (Read on...)
  2. Some prompts are orders of magnitude faster under certain conditions. For me this is the case when I am not connected to the corporate network, and some 'mount' options make the filesystem really slow. In this case, prompt off will be fast.
  3. prompt -c will show the current prompt.
  4. prompt pure will select 'pure' as the prompt engine. This uses asynchronous calls and is significantly faster than prompt powerline or others.

Unapiedra

Posted 2015-11-25T20:25:40.237

Reputation: 625

The problem is more all the processes ran in background. Running a process and discovering the fs in Cygwin is horribly slow. I don't think there is a solution to this issue other than WSL. – nowox – 2017-07-30T10:22:03.393

1What is the prompt command, my fresh cygwin install + zsh + oh-my-zsh, doesn't have it? – Morgoth – 2018-10-05T07:05:18.057