Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

vcs prompt element causing extreme slowness/hanging #323

Closed
briantully opened this issue Oct 7, 2016 · 11 comments
Closed

vcs prompt element causing extreme slowness/hanging #323

briantully opened this issue Oct 7, 2016 · 11 comments

Comments

@briantully
Copy link

Just this week started noticing that my terminal was slowing to a crawl and hanging whenever I was in a git project directory. Literally would take seconds before I was able to do anything in the terminal (iTerm2). After hours of debugging iTerm, my .zshrc file, etc, I switched to several other themes and noticed my terminal acted normally again. I then removed the vcs from my prompt in the powerlevel9k config elements, and now the theme is back to speedy normal. When I add back the vcs prompt, it slows to a crawl.

I'm not sure what was updated recently that would cause this sudden degradation. If I recall oh-my-zsh may have auto-updated last week. I'm running El Capitan 10.11.6 / git 2.10.1 (installed via Homebrew).

powerlevel9k is my favorite theme so I'm hoping I can use it again. Anyone else having this issue with vcs prompt functionality?

Is there a way to use vcs and disable some of the more time consuming/blocking functions?

@bhilburn
Copy link
Member

bhilburn commented Oct 7, 2016

Hi @briantully - We made some significant speed improvements to the vcs segment in the latest release (out just last week). What version of powerlevel9k are you using?

@briantully
Copy link
Author

Hi there Ben!

When debugging this morning I actually pulled in the latest from master when I saw the commit message about speeding up vcs. I was hoping it would be the fix, but unfortunately it didn't have any effect -- my prompt would still hang for 5-10 seconds when in a directory with a git project.

Are there any config elements to simplify/disable some of the vcs functions that may be time intensive?

Sent from my iPhone

On Oct 7, 2016, at 12:38 PM, Ben Hilburn [email protected] wrote:

Hi @briantully - We made some significant speed improvements to the vcs segment in the latest release (out just last week). What version of powerlevel9k are you using?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@bhilburn
Copy link
Member

bhilburn commented Oct 7, 2016

Whoa, the latest commit is that slow for you? That's really strange. You're the first to report slowness with the latest tag.

If you checkout the v0.3.1 tag, do you see the same issue?

@briantully
Copy link
Author

So I dig into the theme and vcs.zsh functions and saw that there was this option

POWERLEVEL9K_VCS_GIT_HOOKS=(vcs-detect-changes git-untracked git-aheadbehind git-stash git-remotebranch git-tagname)

One at a time I disabled/enabled each of the hooks/functions, and for me it seems the git-stash hook is what is causing the hang/slowdown. I was able to work around it by disabling it in my .zshrc, e.g.:

POWERLEVEL9K_VCS_GIT_HOOKS=(vcs-detect-changes git-untracked git-aheadbehind git-remotebranch git-tagname)

All is well in my terminal with git-stash hook disabled :)

@briantully
Copy link
Author

Indeed, it is git stash list that is causing the hang. Running that command independently will cause a 5 second delay before git returns the list of stashes.

Note that I am running the latest version of git (2.10.1) from Homebrew, and I think this is where the issue exists. When I use OS X default git (2.7.4) git stash list returns the list almost instantaneously.

So it appears to be an issue with git 2.10.1 :)

@Herjar
Copy link

Herjar commented Oct 11, 2016

I use powerlevel9k with prezto and it's really slow for large git repositories. I tried to remove git-stash, but it is still slow. The sorin and the pure prompt are pretty much instant. I changed to pure for now as speed is more important than the extra info.

@dritter
Copy link
Member

dritter commented Oct 12, 2016

@briantully How many stashes do you have? Are we talking about just a few, or hundreds? And could you do an time git stash list with git 2.10.1?

@Herjar Do you have a lot of untracked files? This is one of the causes of a slow experience. The reason behind this is that for displaying the VCS_UNTRACKED_ICON we call git status --porcelain, wich gives us a list of all files. Every file gets matched against the .gitignore. AFAIK there is no way to ask git if there are any untracked files (simple boolean). Another difference is that the pure theme gets the information asynchronously.

@briantully
Copy link
Author

I only had 1 stash for the repo I was working on. I generally only have a few in most cases. Even with the 1 stash, git 2.10.1 was taking upwards of 5 seconds.

I deleted 2.10.1 and reinstalled 2.9.3 and 'git stash list' is once again almost instantaneous.

Sent from my iPhone

On Oct 12, 2016, at 3:37 PM, Dominik Ritter [email protected] wrote:

@briantully How many stashes do you have? Are we talking about just a few, or hundreds? And could you do an time git stash list with git 2.10.1?

@Herjar Do you have a lot of untracked files? This is one of the causes of a slow experience. The reason behind this is that for displaying the VCS_UNTRACKED_ICON we call git status --porcelain, wich gives us a list of all files. Every file gets matched against the .gitignore. AFAIK there is no way to ask git if there are any untracked files (simple boolean). Another difference is that the pure theme gets the information asynchronously.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@Herjar
Copy link

Herjar commented Oct 13, 2016

@dritter No I don't think so. As an example just try to clone VSCode (https://github.com/microsoft/vscode). Doing anything in that directory is slow for me with powerlevel9k and instant with pure. Just doing 'ls' I get the results immediatly, but have to wait 1-2sec for the prompt to show up again. If there is no problem for you maybe it's something with my setup.

@dritter
Copy link
Member

dritter commented Oct 14, 2016

@Herjar Hmm. It is not super fast, but ok. We issue git itself a lot (which is not a good thing, but VCS_INFO does not provide all information we want). Do you have a SSD? If not, the many git-calls may be the problem..

@bhilburn
Copy link
Member

@briantully, @Herjar, @dritter - Thanks for looking into this!

Okay, so it sounds like git stash slowed down dramatically between git-2.9.3 and git-2.10.1. Hopefully they resolve this ASAP. It looks like there isn't a git-2.10.2 available, yet, unfortunately.

As @dritter mentioned, the Pure theme uses zsh-async, which might be why it is returning quickly. We are looking in to using this for powerlevel9k, as well.

Closing this bug. @briantully's original problem was tracked to git, and @Herjar's slowness should be solved once #331 is done...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants