-
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
Cloning large repo in libgit2 slower than git clone
#4674
Comments
+1 on this |
+1 |
What I found helps a little is setting |
Disabling |
What also helps is chose the appropriate SHA1 backend when building. I found this rather undocumented flag in the CMake files If i complie with (on macOS/iOS)
it's already quite a bit faster than the default SHA1 c implementation, so maybe set this to a value appropriate for your system. |
So how else can I improve clone performance? Like I said with default settings its not really usable and more than 10 or 100x slower than a |
More data points:
So it is about half the performance (on my machine). Note that I was testing 0.27.7 (the version on Debian Buster). |
I'm assuming this has to do with the fact that native git uses multiple threads to resolve deltas while I can't find any info on whether libgit2 does the same, which leads me to believe it doesn't. |
Judging from the reported CPU-usage (>100% for git, <100% for cgit2), this is likely one contributing factor. However, the "user" time (which I assume is the sum of the times spend in user-space over all threads) is also higher for cgit2, implying some potential for speed-ups. If the measurement covers all the processing done by git (e.g. does not omit some child process), that is. |
Agreed, there is probably some lower-hanging fruit here beforer going multitheraded. I've run git clones with threrading disabled and they don't take as long as libgit2. |
libgit2 is very slow (on the order of 5-10 minutes) to fetch Artichoke when the git revision changes. This appears to be tracked upstream in `libgit2` here: - libgit2/libgit2#4674 - libgit2/libgit2#6038
+1 this issue. I am also experiencing slowdowns due to this issue. |
Can it be that "git clone" command support parallel job where as libgit2 may not use parallel jobs? On big repo I am seeing why more than 1 mins delay, sometimes more like over 10 mins slower using libgit2 |
i am also expieriencing this issue as well. |
Yep, apologies but I've been making incremental progress on this in a branch. |
Libgit2's "Resolving Deltas" code is extremely slow (libgit2/libgit2#4674) on larger repositories, so it is important to have an accurate progress bar to avoid users thinking the download is stuck. We had this implemented. However, we were never actually switching to it, because the progress meter thought the progress was jumping backwards and wouldn't actually update because of it. Fix that by resetting it on the first switch to resolving deltas.
Libgit2's "Resolving Deltas" code is extremely slow (libgit2/libgit2#4674) on larger repositories, so it is important to have an accurate progress bar to avoid users thinking the download is stuck. We had this implemented. However, we were never actually switching to it, because the progress meter thought the progress was jumping backwards and wouldn't actually update because of it. Fix that by resetting it on the first switch to resolving deltas.
I didn't see this when I briefly checked the list of issues, so sorry if it's already been reported. Both libgit2 and
git clone
spend roughly the same amount of time downloading (around 30 seconds or so), but the "Resolving deltas" stage is much slower using libgit2.Reproduction steps
I just cloned
git://sourceware.org/git/glibc.git
using the example code in the repository.Expected behavior
Both libgit2 and
git clone
take roughly the same amount of time.Actual behavior
libgit2 takes around 4 minutes, whereas
git clone
takes about 1.5 minutes.Version of libgit2 (release number or SHA1)
0.27.0 (I've also tested whatever the Rust crate
git2
downloads by default, and the speed was about the same).Operating system(s) tested
Linux alex-linux 4.16.13-2-ARCH #1 SMP PREEMPT Fri Jun 1 18:46:11 UTC 2018 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: