-
-
Notifications
You must be signed in to change notification settings - Fork 814
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
Bad performance when EnableFileStatusFromCache is true #423
Comments
Ping @cmarcusreid. I assume this is an inefficiency in libgit2's status implementation? @Tasteful: I assume the repo in question is private? Does the cache seem to improve performance on your other repositories? |
Yes, the repository is private (corporate). I have a smaller repository (also private) whit 18473 files and the performance is worse with I was setting |
That should be sufficient. Curiously, I am able to reproduce your missing timing in GitHub Desktop's Git Shell, but not in a normal PowerShell window. Odd... |
I'm using normal PowerShell window, started with |
Out of curiosity, what does this give you? gi Function:prompt | select -Exp Definition I'm guessing it's the old $realLASTEXITCODE = $LASTEXITCODE
Write-Host($pwd.ProviderPath) -nonewline
Write-VcsStatus
$global:LASTEXITCODE = $realLASTEXITCODE
return "> " ...or at least a function that doesn't handle |
@dahlbyk You was correct. I have copied the profile.example.ps1 into a startup profile that was containing the old prompt-function and after removed that one I get the timings. And here we have the magic timings.
|
Yeah, that's pretty gross. I imagine @cmarcusreid or the libgit2 team would be interested in optimizing this, but it seems unlikely that the issue is with how posh-git is using the cache. |
That said, what do you see if you set |
So the time seams to be in the |
One thing you might try is using PSGit |
Do you see slow perf on cache hits (try pressing enter on the prompt with no Git commands and no file system changes) or only on cache misses? GitStatusCache has optional logging that might provide more information. You can enable it by modifying the Start-Process invocation in Start-GitStatusCache in GitStatusCachePoshClient.ps1 to include -ArgumentList "--fileLogging --spam" Reload your shell to reload the profile with the new script, and then call Restart-GitStatusCache. The cache should write a log with a name of form "GitStatusCache_[TIMESTAMP].log" into %TEMP%. |
Result with
@cmarcusreid Attached is the git status log with three commands. GitStatusCache_2017-02-18_09-30-31.0.txt When I check the |
Thanks for the log file! The cache is purely in-memory. It will not modify anything in your repository. The log file shows that the slow performance is at the stage where the cache is making a series of calls to libgit2. GitStatusCache is several releases behind the latest libgit2. I haven't been able to reproduce what you're seeing, but given your PSGit result it's possible that a later version of libgit2 will help. It's also possible GitStatusCache is using a libgit2 function not used by PSGit or that something in GitStatusCache itself is slow on your machine. I will cut a draft release of GitStatusCache that snaps to the latest libgit2 release and also adds logging to get finer granularity timings so that we can continue to make forward progress if the libgit2 upgrade doesn't help. |
🆒 I'm going to go ahead and close this since it doesn't seem to be an issue here. Thanks, @cmarcusreid! |
I've opened cmarcusreid/git-status-cache#21 to continue the disccussion. |
System Details
Issue Description
After installing
git-status-cache-posh-client
withchoco install git-status-cache-posh-client
the performance for posh-git is bad and it takes around 5-8 seconds to get the prompt up after any changes in git (exgit add -A
orgit commit -m "..."
).After turning off the git-status-cache with the settings
$Global:GitPromptSettings.EnableFileStatusFromCache=$false
everything is running fast again and the prompt is up after less than 1 second..gitignore
.The text was updated successfully, but these errors were encountered: