The main projects I work on are docs.rs, saltwater cc, and the rust compiler itself.
Normally I compile on my laptop, which is a 4 core 7th gen i5 with 8 GB memory.
When I started working on rustc
itself, that was unbearably slow (over 45 minutes for a stage 1 build),
so I got a second machine just for it. That faster machine has 8 GB RAM and an 8 core 6th gen i7
(although it's normally not running anything besides x.py
and rustc
, so it uses a lot less memory overall).
For fun I'll also throw in my cloud linode: it's extremely underpowered,
a single-core virtual CPU that claims it's an AMD EPYC 7501 but is probably time-shared with another 50 VMs.
It has 1 GB of RAM.
docs.rs takes about 20 seconds incremental to compile, I'm not sure how much of that is linking. However it uses so much memory to compile that it occasionally crashes my laptop. Part of that is probably due to having rust-analyzer running at the same time, but it often happens without too. Full builds vary because we keep changing the number of dependencies but are probably close to 10 minutes. docs.rs has over 400 dependencies which take most of the time for a full build; I have no idea how much they affect max-rss for incremental.
Saltwater has about 90 dependencies and a full build takes about a minute.
Almost all of that time is spent compiling cranelift-codegen
and
cranelift-codegen-meta
; if I could tell cargo to build
cranelift-codegen-meta
before anything else it would probably save a full 15
seconds off the build. Incremental is not too bad, about 2 seconds with lld
.
Link time affect this a lot, changing from ld
to lld
cut off about a
second and a half.
I don't try to compile rustc on my laptop. Last time I tried about 4 months ago it took over 45 minutes for a stage 1 build (not even a full bootstrap).
docs.rs fares a lot better here, about 2 minutes for a full build; I expect most of the improvement is because more dependencies are compiling in parallel. Incremental builds are still pretty bad, 10 seconds for a trivial change (re-ordering imports). The max RSS is almost a gigabyte.
The fast computer doesn't help as much here because the build is so serial; 30 seconds for a full build and max RSS of 800 MB. Incremental is almost the same, about a second and half.
Rustc also does a fair bit better here, only 15 minutes for a stage 1 build (I almost never run a full stage 2 build, let alone stage 2 + tools). I mostly work on rustdoc and the incremental build times are 20-30 seconds which is painfully slow for debugging; I don't need to debug docs.rs as much (usually the bugs are apparent from the errors) and saltwater compiles quick enough I don't mind so much.
I very rarely do full builds for rustc
(about once every 6 weeks after a release),
but I make a lot of different PRs so I do frequent incremental rebuilds.
I don't want to think about how much memory this uses,
but it's at least 9 GB because the computer will start swapping heavily (> 2 GB)
while compiling rustc_middle at the same time as other crates.
See also rust-lang/rust#65031.
I can mitigate this with -j1
but I don't often bother.
This took about an hour last time I tried. It takes so long I don't want to get more numbers.
6 minutes for a full build, 10 seconds for incremental.
lol no