pkgx: bug: pkgx's git is slow
While making my first steps with pkgx, I found that my shell became really slow at giving back the prompt.
Running zsh -x
showed me that it was caused by Git. I was about to start a contribution for the pantry and just executed a dev
command. I realized it installed the git
package from pkgx and that my shell was not using the system Git, but the one from pkgx.
For example, git branch
went from taking about ~3ms to more than 1s!
Here’s a reproduction link: https://github.com/aslafy-z/pkgx-reproduce-slow-git
Do you have any idea where this issue might be coming from?
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Comments: 36 (22 by maintainers)
Commits related to this issue
- fix(git) this prevents our shim from calling pkgx for `git -C . status`, blowing up prompt responsiveness. ref: https://github.com/pkgxdev/pkgx/issues/784 — committed to pkgxdev/pantry by jhheider 8 months ago
- fix(git) clean up shellcheck notices closes https://github.com/pkgxdev/pkgx/issues/784 — committed to dcvz/pantry by jhheider 9 months ago
Is it possible to disable pkgx’s custom git? I’m having http://starship.rs in my shell which displays the git status and branch in the prompt. Usually its super fast, but when running
dev
my shell gets super slow andstarship timings
shows that its because of thegit
commands.@jhheider I opened a PR here: https://github.com/pkgxdev/pantry/pull/4121
This is quite brittle, as it’s just a matter of time before git adds arguments which will require a change here. I would personally like to disable
git-scm.org
globally for when usingdev
because of this, like I mentioned above.This has been requested before. I’m not yet sure how to handle the configuration. We add git so the user doesn’t need the Xcode Command Line Tools to dev which is a feature, though in cases where the user doesn’t want that it is reasonable we allow such opt outs.
you beat me to it, @fredrikaverpil . glad to be of assistance.
this rebuild got it. interestingly, @mxcl,
pkgx +git@latest
didn’t seem to do it, butrm -rf ...
did.it’s possible CI didn’t trigger the build, since I didn’t change the package.yml. sloppy on my part, if so. i’ll trigger a rebuild now.
Thanks all.
pkgx
needs to be way faster in general. We intend to make a cache for pantry reads which should reduce as much as deno makes possible. Eventually we would like to rewrite in rust, but I have too many TODO items before that.The cache should make it so even this situation would have been fast, though I’m glad it wasn’t since we caught the bug.
Need to use
set -u
more often I think.what are friday nights for? 😉
So, 500ms from
pkgx git
to the shim, and 500ms for the extra check with pkgx --provider. Two pkgx startups forgit branch
, 500ms each. A single one forgit --version
.Git is often used in shell prompts like it is in the default codespace setup. It is really slow to work with.
I’ve read in #341 the plan was to rewrite the cli in rust after the 1.0 release. Is it still something you want to do?
https://github.com/pkgxdev/pantry/actions/runs/6438659399
after this, it should only be slow when searching for external commands it doesn’t ship.