-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
ghq
get is slow when directory already exists
#379
Comments
In your case, ghq traverses all repositories three times, and I'll explain why: Firstly, before getting or updating a repository, ghq traverses all repositories to determine if a specific repository exists. Secondly, after getting or updating a repository, ghq attempts to match the repository with the provided URL. However, it matches the repository's subpath, which results in not finding a match. Lastly, ghq parses the URL provided by the user and uses the parsed information to match the repository, where it succeeds in finding a match. Overall, the execution time of the ghq get -l command is approximately three times longer than the ghq get command. |
Thank you for the explanation. However, don't you feel 7 secs is reasonable? Does that depend on the number of repository I've already checked-out? |
I have created a PR here to ensure that it scans all repositories only once in your scenario. By the way, how many projects do you have? I have dozens of projects, and it only takes me 40 milliseconds to scan them. |
You can use this command to display the projects:
And, I think |
When the list of repositories in my ghq source directory got large, it was getting extremely slow when performing a clone[^1][^2]. It turns out that I have a lot of directories that are not managed by git especially within my work folder. I was able to figure this out after moving out the _work_ directory outside the `~/Sources` dir. I found https://github.com/siketyan/ghr and it seems to be fast because it doesn't check `.git` folders (which I'm fine with) Refs: [^1]: x-motemen/ghq#323 [^2]: x-motemen/ghq#379
Hello 👋
First, thank you for your tool, which is really good and I use it a lot… maybe too much considering this issue 😅.
Sometimes, when I want to jump into a directory, I use
ghq get -l <repo_url>
and it's very slow (~7 seconds). Seehyperfine
results:I also include
ghq
in scripts when I have to automate tasks… and it's slow (+2sec), especially when the repository is already here. See results just for aget
on an already existing repository:Is there something misconfigured on my setup or it's expected?
The text was updated successfully, but these errors were encountered: