Skip to content
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

hg_prompt is slow for large repos #14

Open
satayev opened this issue Jan 20, 2021 · 4 comments
Open

hg_prompt is slow for large repos #14

satayev opened this issue Jan 20, 2021 · 4 comments

Comments

@satayev
Copy link
Contributor

satayev commented Jan 20, 2021

It boils down to two invocations: hg branch and hg stat. Both can be significantly slow for large repos which makes it difficult to use prompt.gem there.

@satayev
Copy link
Contributor Author

satayev commented Jan 20, 2021

See #15 for a fix for branch invocation.

For stat invocation, I am not sure there is an easy fix. I personally just ended up removing it from my local prompt.gem, perhaps it's worth adding a base.conf.sh variable to conditionally execute it.

@dimo414
Copy link
Owner

dimo414 commented Jan 25, 2021

Thanks for filing, yes hg_prompt is painfully slow. I've been meaning to revisit it but I have fewer Mercurial repos these days so it hasn't been as noticeable for me.

Also (as you may be aware) these expensive functions are cached by http://github.com/dimo414/bash-cache, so the slowness shouldn't be as noticeable in a shell that's actively being used. Tuning the cache duration might be an easy improvement, in addition to investigating better implementations.

I personally just ended up removing it from my local prompt.gem

FWIW the intended way to do so is to remove it from the ENV_INFO var in your local.conf.sh. Removing it from your local checkout is fine too, obviously, but you may have to resolve merge conflicts at some point.

@satayev
Copy link
Contributor Author

satayev commented Jan 25, 2021

Agreed, bash-cache is amazing! I am just pushing some general changes I made to profilegem, and thought some of these changes are generic / good enough to be shared.

I do keep hg_prompt in ENV_INFO; however I removed the call to hg stat and added branch & bookmark calls. So, I know what feature I am working on, but I don't know if the working dir is dirty or not. (Instead of defining my own hg_prompt separately.)

P.S. speaking of hg_prompt, it may be worth including hg bookmark information as well; but that's a separate issue.

@dimo414
Copy link
Owner

dimo414 commented Jan 25, 2021

Gotcha, yes customizing the implementation of hg_prompt makes sense. And feel free to send a PR adding hg bookmark :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants