Open
Description
Problem
When compiling a project that uses a lot of git dependencies it takes a lot of time for cargo
to download them.
Example that I just seen:
- It took minutes to download 50 git dependencies
- It then took 7.23 seconds to download 300 crates.io dependencies
Seems like there is a big potential for optimizations here.
Steps
- Clone https://github.com/zed-industries/zed/tree/main
- Run
git submodule update --init --recursive
- Run
cargo build
- Observe the slow downloading of git dependencies
Possible Solution(s)
- Using a shallow clone, instead of clonning the full repo
- Downloading multiple repositories in parallel
Notes
You may need to delete some caches to be able to repeat this test. I think you need to delete ~/.cargo/git/
.
Version
cargo 1.76.0 (c84b36747 2024-01-18)
release: 1.76.0
commit-hash: c84b367471a2db61d2c2c6aab605b14130b8a31b
commit-date: 2024-01-18
host: x86_64-unknown-linux-gnu
libgit2: 1.7.1 (sys:0.18.1 vendored)
libcurl: 8.5.0-DEV (sys:0.4.70+curl-8.5.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w 11 Sep 2023
os: Arch Linux Rolling Release [64-bit]