Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very Slow prompt return #21

Closed
developingchris opened this issue Dec 14, 2011 · 4 comments
Closed

Very Slow prompt return #21

developingchris opened this issue Dec 14, 2011 · 4 comments

Comments

@developingchris
Copy link

It takes several seconds for the branch and change stuff to show up.
Is this a core thing in posh-git.

I'd love to understand more about the implementation of how the information is gathered from the repo.

@developingchris
Copy link
Author

This is repeatable on several normally sized repos. I believe it comes down to all of the test-paths inside the get Git branch. call. But are they all necessary. doesn't the "git branch" command provide you with sufficient info to determine the branch?

@dahlbyk
Copy link
Owner

dahlbyk commented Dec 14, 2011

Performance has been an open issue pretty much from the beginning. You can set $GitPromptSettings.Debug = $true to get a better idea where your performance bottleneck is.

The most common msysgit configuration uses git.cmd, which adds environment overhead to every call. To speed things up a bit you can use git.exe instead of git.cmd. You just have to port some of the settings in git.cmd into your PowerShell profile. Something like this:

$GitInstallDir = 'C:\Program Files (x86)\Git'
$Env:Path = "$GitInstallDir\bin;$GitInstallDir\mingw\bin;$Env:Path"
if(!$Env:HOME) { $Env:HOME = "$Env:HOMEDRIVE$Env:HOMEPATH" }
if(!$Env:HOME) { $Env:HOME = $Env:USERPROFILE }

$Env:PLINK_PROTOCOL = 'ssh'

On my system that trimmed around 300ms off every git call.

Beyond that, by default posh-git should populate almost everything in the prompt from parsing a single git status call and checking for the existence of a few files. If git status is slow, posh-git will be slow.

You can also set $GitPromptSettings.EnableFileStatus = $false to skip the git status call altogether - parsing branch information manually is much faster.

lei-yu-wdfc pushed a commit to lei-yu-wdfc/posh-git that referenced this issue Aug 31, 2012
@rkeithhill
Copy link
Collaborator

Maybe we should close this issue given its age and the fact that I'm seeing prompt times in the area of <100 ms on small repos and ~300 ms on medium size repos (6500 files).

@dahlbyk
Copy link
Owner

dahlbyk commented Jan 27, 2017

Between improvements in Git for Windows, #208, and various posh-git optimizations, I think we're doing about as well as we can.

@dahlbyk dahlbyk closed this as completed Jan 27, 2017
ExE-Boss pushed a commit to EB-Forks/posh-git that referenced this issue Aug 31, 2018
Added hg flow patterns to HgTabExpansion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants