-
Notifications
You must be signed in to change notification settings - Fork 67
Description
Unless I'm misunderstanding something, currently one must use gz
or xz
as compression formats. Because of this, during the building of rust itself, the fabricate
process uses 100% CPU (aka 1 core only) and thus wastes a lot of time trying to compress to one or both of the two formats (specified in config.toml)
On systems where the filesystem is btrfs and using zstd compression already, some may wish to use no compression at all, thus just .tar
(instead of .tar.gz
or .tar.xz
would be preferred). Maybe such people don't care about any extra used space(presumably filesystem compression if poorer than .gz or .xz ?), or they do care about how much time rust compilation takes (it would take less time this way with avoiding doing any compression especially since it's using only one CPU core).
Either way, I'd like to suggest supporting no compression at all - which would probably mean simply just .tar
In the past I used to hack a patch to do this (.tar
instead of .tar.gz
) and it worked just fine, but since v1.48.0 rust's changed that code a bit in 1.52.0 and I'm unable to understand how to change the patch to apply it, so far.
Activity
acheechee commentedon May 11, 2021
EDIT: a 10 minute save with this patch (down to 45mins from 56mins) to emerge 'rust' on Gentoo.
I've decided that it's unlikely this will be implemented soon enough so I went back to re-make my hacky patch(that avoids compression and keeps the files as
.tar
) to work for 1.52.0 rust version, and this is it:I'm using this on Gentoo if it matters... and with this ebuild:
Without patch it used to emerge rust in 56 mins (ran it twice and got the same time), but now, with this patch, it does it in ... about 43 mins (second run was: 45mins because I was also watching a movie meanwhile
)
In the 'compile' phase(./x.py dist)(this takes like 33 mins to complete), some
.tar
(instead of.tar.gz
) files get generated in dir:/var/tmp/portage/dev-lang/rust-1.52.0/work/rustc-1.52.0-src/build/dist
In the 'install' phase(./x.py install)(this takes like 10 mins to complete), some of the above files get regenerated(those from timestamp 0:41am inclusive):
Actual
config.toml
used while building (based on the above ebuild):aswild commentedon Aug 30, 2021
This has been on my wishlist for a while, compressing tarballs only to immediately decompress them is a big bottleneck for local installs. Here's a proof of concept that adds a proper no-compression mode. If there's maintainer interest, I'd be happy to turn this into a PR.
The speedup is significant, since the vast majority of the time during
dist
orinstall
is spent on compression. Tested on my PC with an i7-8086K and an NVMe drive. I configured an extended build (cargo, clippy, rustfmt) and did./x.py build --stage 2
so all the times here are just dist/install and no recompiling../x.py install
./x.py dist
build/dist/
rust-installer patch:
rust (bootstrap) patch:
correabuscar commentedon Sep 28, 2022
Thanks aswild! I'm using your patch on Gentoo for
dev-lang/rust-1.64.0-r1
and theinstall
phase takes (at least) this long:and yield the following in
/var/tmp/portage/dev-lang/rust-1.64.0-r1/work/rustc-1.64.0-src/build/dist
:(while the
compile
phase takes this long:)
One thing to note is that user can override compression format in
config.toml
(via a modified.ebuild
) like:compression-formats = ["gz"]
(while the default is the overridden 'xz' in Gentoo) and wonder why the patch isn't working.That (gz)
install
phase would take, at least:and yield:
The exact patch that I used is inside this(ie. click me to expand):
onur-ozkan commentedon Feb 25, 2024
This should be no longer needed as rust-lang/rust#118724 PR is merged.