dahlbyk / posh-git

A PowerShell environment for Git
http://dahlbyk.github.io/posh-git/
MIT License
7.62k stars 801 forks source link

`EnableFileStatus = $false` does NOT fix bad perf in large repo #882

Closed AArnott closed 2 years ago

AArnott commented 2 years ago

System Details

Issue Description

In very large git repos, posh-git perf is abysmal. Even when turning off file status. See here an example:

PS C:\VS.r>
PS C:\VS.r> import-module posh-git
C:\VS.r [(0688549...)]> $GitPromptSettings.DefaultPromptEnableTiming = $true
C:\VS.r [(0688549...)] 18952ms> $GitPromptSettings.EnableFileStatus = $false
C:\VS.r [(0688549...)] 14910ms>

Turning off file status trims off about 3 seconds of 18, leaving 15 seconds. What is happening during those 15 seconds and how do I turn that off too?

I'd eventually like to use $GitPromptSettings.RepositoriesInWhichToDisableFileStatus += 'c:\vs.r' to fix perf for just this repo and use file status for all other repos, but after some analysis I found that even turning it off completely (as above) it doesn't solve the problem.

AArnott commented 2 years ago

After git gc we're down to 738ms when EnableFileStatus = $false and 5849ms when EnableFileStatus = $true.

Still, 738ms is very slow for just looking up the branch name.

rkeithhill commented 2 years ago

Could you temporarily move the module out of the OneDrive folder and into your ~\Documents\PowerShell\Modules folder to see if that makes any difference?

AArnott commented 2 years ago

I'm happy to try this out. But there is no Documents folder under my profile path. Literally if I try to navigate to C:\Users\andarno\Documents\PowerShell it redirects to C:\Users\andarno\OneDrive\Documents\PowerShell. Is there some other location I could try moving the module to? And could I then tell PowerShell to load it directly from there?

rkeithhill commented 2 years ago

Gotcha. In that case, can you try moving the posh-git module folder to $PSHome\Modules e.g. 'C:\Program Files\PowerShell\7\Modules\'?

AArnott commented 2 years ago

Just tried it. It doesn't seem to make any difference. Although now, no matter which location posh-git is in, the prompt takes only about 100ms to appear, which is perfectly fine. I don't know why yesterday it was taking 738ms.

dahlbyk commented 2 years ago

Can we close this?