Love it - but just feel it's too slow!

686 views
Skip to first unread message

Ronnie Barker

unread,
Apr 14, 2010, 4:27:02 AM4/14/10
to posh-git
Don't you find the git calls necessary to put all of the status info
in there are just too damn slow? prompts should be faster...

Would there be possible to change the window title asynchronously - so
that the snappiness of the prompt is still there and 'some-time-later'
the title bar has all of the extra data?

Ronnie

Mark Embling

unread,
Apr 14, 2010, 4:30:28 AM4/14/10
to posh...@googlegroups.com
I do agree with you, it is too slow (especially if you're unlucky enough to be using the msysgit version of git1.7). That's certainly an interesting idea, but I very much like having the information in the prompt.

Personally, I would prefer to speed the prompt up by reducing git calls where possible, rather than moving it into the title bar. Having said that though, I don't know how well that might suit others? In addition, I'm afraid I don't know enough to say off the top of my head whether the title bar text can be changed async.

Certainly we need to address the speed issue in one way or another if possible.




--
To unsubscribe, reply using "remove me" as the subject.

Jeremy Skinner

unread,
Apr 14, 2010, 4:53:42 AM4/14/10
to posh...@googlegroups.com
Agreed that it is quite slow - it is making a *lot* of git calls under the covers (and if you're using msysgit 1.7 it's even slower still). Personally I actually run a slimmed-down version that makes fewer calls, but at the cost of some of the functionality.

Jeremy

Keith Dahlby

unread,
Apr 14, 2010, 8:20:38 AM4/14/10
to posh...@googlegroups.com
First, updating the title is a good idea, and yes it can be done asynchronously:
    $Host.UI.RawUi.WindowTitle = 'whatever'

I've been looking at PowerShell's job mechanism as a way to either 1) run all the prompt's git calls in parallel, or 2) update the slow status info in a background thread. Git also does a fair amount of caching that I'm not sure we're properly taking advantage of.

Either way, my first inclination is to wrap some settings around the slow bits (index/working copy counts) and have the default prompt just show branch information, which is what bash and zsh do.

Thoughts?

Thanks for the feedback, Ronnie!

Keith

Jeremy Skinner

unread,
Jun 19, 2010, 10:37:18 AM6/19/10
to posh...@googlegroups.com
Hi everyone,

I spent some time today writing a more efficient version of get-gitstatus. This parses the output of "git status" and "git status -s" in order to gather  1) branch information 2) ahead/behind 3) index status 4) file status. 

This ends up being significantly faster as there are fewer calls to git. The only functionality that this does not replicate is rebase/merge/bisect branch information that was performed by Get-GitStatus, but as this information is shown fairly rarely I consider it to be less important than a fast prompt.

This also means we can remove the "AutoRefreshIndex" setting as git status performs the necessary refreshing internally. 

I also added some additional settings for BeforeIndexText/BeforeIndexForegroundColor/BeforeIndexBackgroundColor. This allows you to insert additional text before the "index" portion of the prompt. For example, I have the following settings in my profile:

$global:GitPromptSettings.BeforeText = ' on '
$global:GitPromptSettings.BeforeForegroundColor = [ConsoleColor]::White
$global:GitPromptSettings.AfterText = " `ngit"
$global:GitPromptSettings.DelimText = " working"
$global:GitPromptSettings.DelimForegroundColor = [Consolecolor]::DarkGray
$global:GitPromptsettings.BeforeIndexText = " index"
$global:GitPromptSettings.BeforeIndexForegroundColor = [ConsoleColor]::DarkGray
$global:GitPromptSettings.IndexForegroundColor = [ConsoleColor]::Yellow

...which produces a prompt like this: http://yfrog.com/6xpopkp

I've pushed these changes to my fork - please give them a try and let me know if I've missed anything. 

Jeremy

Jeremy Skinner

unread,
Jun 22, 2010, 5:17:58 PM6/22/10
to posh...@googlegroups.com
I realised that my tweaks to get-gitstatus broke some of the tab expansion, but I've now fixed this in my fork.

Jeremy

Keith Dahlby

unread,
Jul 22, 2010, 2:54:40 AM7/22/10
to posh-git
So I haven't pulled this status change yet because --short is only
available in 1.7 and I'm still on 1.6. Have the 1.7 performance issues
been resolved?

Keith
> > On 14 April 2010 13:20, Keith Dahlby <dahl...@gmail.com> wrote:
>
> >> First, updating the title is a good idea, and yes it can be done
> >> asynchronously:
> >>     $Host.UI.RawUi.WindowTitle = 'whatever'
>
> >> I've been looking at PowerShell's job mechanism as a way to either 1) run
> >> all the prompt's git calls in parallel, or 2) update the slow status info in
> >> a background thread. Git also does a fair amount of caching that I'm not
> >> sure we're properly taking advantage of.
>
> >> Either way, my first inclination is to wrap some settings around the slow
> >> bits (index/working copy counts) and have the default prompt just show
> >> branch information, which is what bash and zsh do.
>
> >> Thoughts?
>
> >> Thanks for the feedback, Ronnie!
>
> >> Keith
>
> >> On Wed, Apr 14, 2010 at 3:53 AM, Jeremy Skinner <
> >> jer...@jeremyskinner.co.uk> wrote:
>
> >>> Agreed that it is quite slow - it is making a *lot* of git calls under
> >>> the covers (and if you're using msysgit 1.7 it's even slower still).
> >>> Personally I actually run a slimmed-down version that makes fewer calls, but
> >>> at the cost of some of the functionality.
>
> >>> Jeremy
>

Jeremy Skinner

unread,
Jul 22, 2010, 3:12:58 AM7/22/10
to posh...@googlegroups.com
1.7 is still somewhat slow compared to 1.6, but with these changes I find it works at a usable speed. I believe there's going to be a 1.7.1 release sometime soon, I hope that might speed things up a bit more.

Jeremy

Keith Dahlby

unread,
Jul 28, 2010, 2:44:48 PM7/28/10
to posh...@googlegroups.com
I've pushed a git1.7 branch with an update to the git status code based on Jeremy's spike. It depends on msysgit 1.7.1 beta and seems to fix the performance problems for my large repos.

http://github.com/dahlbyk/posh-git/tree/git1.7

huy

unread,
Sep 2, 2010, 12:30:06 PM9/2/10
to posh-git
Hi Guys,

Firstly, thanks for posh-git. I only found posh-git today after
needing an alternative to bash git.

I also experienced this slowness so was looking for another solution.
In my prompt I'm mainly interested in the branch that i'm currently
on.
For this, I've found this to be super fast.

function prompt {
Write-Host ($status_string + $(get-location)) -nonewline -
foregroundcolor darkgreen

$git_dir = ".git"
if(Test-Path $git_dir) {
$branch = cat $git_dir\HEAD
Write-Host(" [" + $branch.split('/')[2] + "]") -nonewline -
foregroundcolor yellow
}
Write-Host(" $") -nonewline -foregroundcolor darkgreen
return " "
}

What do you guys think ? maybe add it as a "short" version of the
current prompt.

Cheers

Huy

On Jul 29, 4:44 am, Keith Dahlby <dahl...@gmail.com> wrote:
> I've pushed a git1.7 branch with an update to the git status code based on
> Jeremy's spike. It depends on msysgit 1.7.1 beta and seems to fix the
> performance problems for my large repos.
>
> http://github.com/dahlbyk/posh-git/tree/git1.7
>
> On Thu, Jul 22, 2010 at 2:12 AM, Jeremy Skinner
> <jer...@jeremyskinner.co.uk>wrote:
>
>
>
> > 1.7 is still somewhat slow compared to 1.6, but with these changes I find
> > it works at a usable speed. I believe there's going to be a 1.7.1 release
> > sometime soon, I hope that might speed things up a bit more.
>
> > Jeremy
>

Keith Dahlby

unread,
Sep 2, 2010, 1:06:51 PM9/2/10
to posh...@googlegroups.com
I like the idea of a short prompt without the (slow) file-based status. Your code below works for simple cases, but it doesn't cover more interesting scenarios like merge conflicts, rebasing, bisecting, etc. As I tend to do a lot of rebasing, having a reminder in the prompt is super-helpful.

Maybe we could add a setting to turn off the file status altogether, but keep the smarter branch info?

huy

unread,
Sep 5, 2010, 10:49:33 PM9/5/10
to posh-git
Yeah, I was just looking for the fastest way possible to find my
current branch. Running git to get info was generally slow on windows
(there's always a slight pause).
Generally that's all i'm interested in on my prompt as I use it more
for non-git commands then I do git commands.
I use git status for everything else.

I think our sentiments are the same. The prompt should not have a
noticeable pause from one command to the next.
The more info that's displayed on the prompt without jeopardizing this
rule the better.

Cheers,

Huy

Jeremy Skinner

unread,
Sep 6, 2010, 4:23:17 AM9/6/10
to posh...@googlegroups.com
The version of posh-git in the master branch uses "git status -s -b" to get both the branch and the status information in one go (requires msysgit 1.7.1). On my machine at least, this is instantaneous.

Jeremy

huy

unread,
Sep 8, 2010, 1:27:28 AM9/8/10
to posh-git
I'm running windows 7 (64bit) and it's slow (takes 4 secs for that
command).
Not sure what my problem is, but it was all very fast on Vista (64bit)
same machine.

Thanks

Huy

Jeremy Skinner

unread,
Sep 8, 2010, 3:06:31 AM9/8/10
to posh...@googlegroups.com
Interesting...I'm also on win7 x64 and am not seeing this issue. Are you definitely running 1.7.1? 

Also, if you're running an antivirus be sure to exclude the contents of the git installation from the on access scan....I've seen this cause serious performance problems with msysgit and certain antiviruses.

Jeremy 

huy

unread,
Sep 13, 2010, 8:08:38 AM9/13/10
to posh-git
Hi Jeremy,

Definitely running 1.7.1. Tried running without antivirus, and problem
still persists.

Seeing as you don't have the problem, it must be something in my
setup.
I'll post back if I ever find out what. Hopefully future git upgrades
might make it go away.

Regards,

Huy
> ...
>
> read more »

Keith Dahlby

unread,
Sep 13, 2010, 9:14:48 AM9/13/10
to posh...@googlegroups.com
The size of your repository definitely factors in as well - it may just be that you're working with larger repositories than we are. Have you run git gc recently?

Keith

Keith Dahlby

unread,
Sep 16, 2010, 2:55:18 AM9/16/10
to posh...@googlegroups.com
I just pushed an EnableFileStatus setting that skips the call to git status, showing only the branch info. Disabling file status will also turn off the branch color toggle when it's ahead.

To turn it off, just add this as the last line in your $PROFILE:

$Global:GitPromptSettings.EnableFileStatus = $false


Keith

huy

unread,
Oct 5, 2010, 10:07:17 AM10/5/10
to posh-git
Tried git gc and problem still there. Funny thing is that running git
on the same repository in a centos virtual machine (virtualbox) on the
same computer is nice and fast.

Huy
> ...
>
> read more »

Keith Dahlby

unread,
Oct 5, 2010, 10:15:58 AM10/5/10
to posh...@googlegroups.com
The lastest in my master includes an EnableFileStatus setting that will turn off the call to "git status" that takes the longest. The downside is that you lose tab completion on new/changed/deleted files.

To turn file status off, just add this to your $PROFILE:

$global:GitPromptSettings.EnableFileStatus = $false


There's also a new version of msysGit that might include performance improvements. Beyond that, I'm not sure what to suggest.

Cheers ~
Keith
Reply all
Reply to author
Forward
0 new messages