zwild/eshell-prompt-extras

Very slow in directories with git repositories

Closed this issue · 8 comments

Hello,

I've opened an issue at the spacemacs repo but as it turned out disabling eshell-prompt-extras "fixes" the sluggishness. As the other commentator points out, it must be sth unoptimized in this package which causes it.

I'm not very fluid in the internals of Emacs/Lisp so please let me know when I should run some commands to isolate the bottleneck.

Can you reproduce the issue without your init file? i.e., from emacs -Q, run something like the following in the Terminal:

open -n -a Emacs --args -Q -L ~/src/eshell-prompt-extras -l eshell-prompt-extras --eval "(setq eshell-highlight-prompt nil eshell-prompt-function 'epe-theme-lambda)" -f eshell

And what's the version of eshell-prompt-extras you are using? You should use the latest when it is possible.

Yes, I can reproduce it. It's fast without perceptible delay in non-git directories and really slow otherwise—as in ls -la takes a few seconds before displaying anything.

I've cloned HEAD into a local copy to test it. The version my Spacemacs setup uses is:

Generating autoloads for eshell-prompt-extras.el...done
Wrote ~/.emacs.d/elpa/26.0/develop/eshell-prompt-extras-20180109.2234/eshell-prompt-extras-autoloads.el
...

Is M-: (epe-theme-lambda) also slow in such git directories? If it is, then check if (epe-git-dirty) etc is slow as well. Maybe running git through shell, e.g., (shell-command-to-string "git ..."), is slow on your system. If it is not, I don't know where else can cause the slowness for you, eshell-prompt-extras is a very simple package, thus you should be able to understand how it works without much Emacs Lisp knowledge.

Hmm, I'm using the latest High Sierra OSX 10.13.3 (17D47) and latest iTerm2:

  • M-: (epe-theme-lambda) — takes a few sec
  • M-: (epe-git-dirty) — faster than above, but still pretty slow
  • M-: (shell-command-to-string "git status") — also noticeable lag

M-: (shell-command-to-string "git status") — also noticeable lag

I guess M-! git status is also slow for you., thus the slowness you encountered is not caused by eshell-prompt-extras. What's the shell are you using (bash/zsh/etc)? You should be able to know it by running echo $SHELL in iTerm2 or checking the shell-file-name variable in Emacs.

You're right. zsh is causing it. The issue vanishes when switching to bash. I've commented out all of my .zshrc but the issue remains. So I guess it's something more fundamental...

@xuchunyang Not sure how to proceed with this issue — shall I close it or leave it open as a "note for others"?

I ran into this issue and came accross this issue. Basically, for me it wasn't zsh, it was nvm.