This PR replaces most (but not all) git commands in the git resolve with libgit2 behaviors.
Benchmarks
Overall true git clones appear faster than libgit2, but libgit2 clones consume significantly less memory. If not employed already, concurrency may help.
A benchmark on a repo with many dependencies using hyperfine (gshards is the release binary using libgit2).
Benchmark 1: rm -Rf lib && shards install --without-development
Time (mean ± σ): 4.076 s ± 0.263 s [User: 1.844 s, System: 1.789 s]
Range (min … max): 3.847 s … 4.669 s 10 runs
Benchmark 2: rm -Rf lib && gshards install --without-development
Time (mean ± σ): 5.929 s ± 0.827 s [User: 0.721 s, System: 1.340 s]
Range (min … max): 5.484 s … 8.264 s 10 runs
Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.
Summary
'rm -Rf lib && shards install --without-development' ran
1.45 ± 0.22 times faster than 'rm -Rf lib && gshards install --without-development'
Notes
Libgit2 is highly configurable, and so is Grits so far. Supporting more complex features programmatically may be easier.
Statically linking libgit2 would remove a dependency (known)
Historically libgit2 hasn't had support for shallow clones. This is no longer the case as of 2 weeks ago. Clones can do shallow fetches and it appears a fetch can unshallow a shallow clone. This could significantly improve performance. Grits is currently locked at v1.3 so it would need to be updated.
Oh shoot. I didn't mean to PR this against canonical, just my own fork. It's meant for discussion, and I think it could be a win to implement fully, but I'd love to hear thoughts.
Changes
This PR replaces most (but not all) git commands in the git resolve with libgit2 behaviors.
Benchmarks
Overall true git clones appear faster than libgit2, but libgit2 clones consume significantly less memory. If not employed already, concurrency may help.
A benchmark on a repo with many dependencies using
hyperfine
(gshards is the release binary using libgit2).hyperfine 'rm -Rf lib && shards install --without-development' 'rm -Rf lib && gshards install --without-development'
Notes
unshallow
a shallow clone. This could significantly improve performance. Grits is currently locked atv1.3
so it would need to be updated.