Reducing the memory/bandwidth footprint of submodules with ./x.py? #63978
Labels
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-bootstrap
Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
I recently tried to compile rust by using the
./x.py
script. I noticed that the first thing that happens is a full clone of all the git submodules (see https://github.com/rust-lang/rust/blob/master/src/bootstrap/bootstrap.py#L679-L687).Cloning the whole history of all the submodules is generally of little interest to compile the current version of rust, but it has a non-negligible memory footprint. Today, the largest submodules are:
src/llvm-project
with 696.10 MiB of historysrc/doc/rust-by-example
with 136.06 MiB of historyDownloading so much data can be detrimental for several reasons:
I've tried to tweak the lines in the above
bootstrap.py
script to limit the depth of the submodule update. Unfortunately, using--depth=1
doesn't work, because the submodule commit referenced here may not be the latest in the submodule repo, and apparently git cannot clone at a specific commit.However, I found that
--depth=20
(and--depth=1
forllvm-project
) was working on today's state. Overall, this reduced the overhead of submodule updates quite significantly.Of course, this isn't bullet-proof:
Nonetheless, would it make sense to add an option (CLI flag to
./x.py
for example) that allows to manually reduce the cloning depth?The text was updated successfully, but these errors were encountered: