-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Improve performance for git prompts (on PowerShell) #4880
Comments
Currently doing some reading about this. I like the note that's here on romkatv gitstatus README's Why Fast. This does make a lot of sense and I might seek to replicate the scenario used in the benchmarks. I also understand the idea behind the PRs you listed from posh-git PR 924 using Get-GitConciseStatusFromCache (which is defined here). There is a oh-my-posh does have a cache declared within the JSON file at Here is the Will dig further into the codebase to see what can be done and maybe put out a PR. |
@brian6932 what would be really cool is if there is a Go package available with the logic :) |
There's https://github.com/go-git/go-git I guess, you'd have to implement the caching on top of it, or just use the code from https://github.com/go-git/go-git/blob/master/status.go and work from there, as it'd reduce dependencies. |
Go git is terribly slow, tried it before. I don't mind adding support for existing cache tools, I'm not in favor of adding logic that aims to do what git itself should improve (faster status). |
I found starship (which uses |
@brian6932 check, but as a maintainer, I need to be careful how far this can get pushed. And that's an implementation where I want to be in the lead so I can also keep offering support. It's not easy or straightforward or git would've fixed it already. |
Any updates on this? zsh had similiar problems and got it solved some time ago |
@elbkind this isn't shell related, it's git that's slow. I'm assuming you refer to powerlevel10k which implies the maintainer there created his own git status parser. This isn't straightforward and basically a path towards hell if you start messing with internals too much. I'm adding segment level caching that will for sure help with this, as you might not care for status every time, but in the end, it's git that's slow. |
@JanDeDobbeleer powerlevel10k's approach is indeed to offload the actual git interrogation to a another program called |
@jonathanjsimon there are two elements here we can play with. Make your own git status parser, or identify when the folder contents changed. The first option is off the table for me, unless if I happen to make a living off of this. The second option could be feasible, depending on how fast we can determine that. Maybe there's another option I don't see yet though. |
@JanDeDobbeleer |
@jonathanjsimon I respect his work, but as PL10K was also put on "hold", I'm not inclined to include work that's still dark magic for the most part and probably will only get best effort support as well. Not a strong foundation. |
@JanDeDobbeleer totally fair. |
Code of Conduct
What would you like to see changed/added?
posh-git
's not really maintained, there has been an open PR to improve thegit status
performance for quite some time (dahlbyk/posh-git#924). It's currently extremely sluggish (yes even with"ignore_submodules":{"*":"none"}
). Realistically to have consistent performance across all supported shells, it would be nice foroh-my-posh
to have it's owngit status
handling, either withgit-status-cache
or with it's own cache. Since that's a bit more involved, a quick solution for now would be to use https://github.com/zhengweidi/git-status-cache-posh-client/tree/master with https://github.com/zhengweidi/git-status-cache/tree/master, or something like gitstatusd https://github.com/romkatv/gitstatus.The text was updated successfully, but these errors were encountered: