-
-
Notifications
You must be signed in to change notification settings - Fork 661
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
libgit2 git_status_list_new is really slow. #28
Comments
Yeah, I've had reports of the Git functionality being really slow on large Git repositories. I'm looking into what I can do with libgit2 to mitigate this. As you say, it seems to process a lot of SHA1 hashes before it even starts doing anything, and I think that I'm asking it to do a lot more work than I need to. I'd rather not call Git directly, as it's hard to get it working accurately when you're outside of the repository directory (you have to find the root). If I can't find a way to speed it up in the near future, I'll at least include a --no-git stopgap so you can disable the column on a per-invocation basis. |
Asking libgit2 to update the index shaves about a half of a second off of subsequent runs but none of the other options helped (except passing |
|
It shouldn't do that! Let me test this. |
Confirmed - that's definitely wrong! |
This is very slow (see #28) at the moment, so there's an option to switch off repo discovery. However, they were still always being queried. Now, if there's no Git option in the flags, it won't try to discover a repo.
d547c3f should fix it. Thanks for noticing the problem! |
I think this might be related: libgit2/libgit2#4230 |
I think the problem is that it searches in all subfolders, although only the current folder is needed. You can see that if you take any larger folder that is not yet a git repo, make it git repo with The |
exa is getting all the statuses of every file though the libgit2 and store them so it only had to query them once. Now I guess we could try to ask just about the file we find if it’s faster (or use that strategy only when we don’t recurse or something like that), or just parse the output of Anyway, it’s a non-trivial amount of work for something that already works, so any help is welcome. |
For me, exa takes ~3 seconds to run on the rust repository and most of this time is spent in libgit2's git_status_list_new function (specifically, it appears that most of this time is spent calculating SHA1 hashes). However,
git status --porcelain
runs in about .1 seconds. The correct fix would be to fix libgit2 however, in the meantime, you might consider usinggit
directly.Note
git2::Repository::statuses(opts)
is a wrapper for libgit2'sgit_status_list_new
function.The text was updated successfully, but these errors were encountered: