Nix Rust | 674 Members | |
| Rust | 154 Servers |
| Sender | Message | Time |
|---|---|---|
| 29 Mar 2026 | ||
(actually i lied, we can probably cut off a minute and a half from each of the intermediate builds, but we don't feel like looking more into bootstrap right now. but other than that, i think shaving off any further time from the intermediate builds would require diving deeper into compiler flags and whatnot that might help. (or you know. running on a faster machine)) | 18:35:16 | |
so, we've been playing with rustc bootstrapping out of tree at https://codeberg.org/whispers/nebula/src/branch/meow/nix/pkgs/rust-bootstrap. the code itself is pretty bad, but we've got some initial performance metrics.
.override { ... }, so this is the part we build right now in nixpkgs.(take these as order of magnitude estimates, the numbers are extremely noisy. build were run on several different days with other things running on my laptop.) so yeah. the start and end of the chain are expensive, and both are fairly constant cost. the intermediate versions have a relatively small linear coefficient, and we've done what we're aware of to make these builds do as little work as possible, but it's probably not small enough to be tenable as the distance between stable and what mrustc supports grows. | 18:35:42 | |
(actually i lied, we can probably cut off a minute and a half from each of the intermediate builds, but we don't feel like looking more into bootstrap right now. but other than that, i think shaving off any further time from the intermediate builds would require diving deeper into compiler flags with diminishing returns. (or you know. running on a faster machine)) | 18:37:42 | |
so, we've been playing with rustc bootstrapping out of tree at https://codeberg.org/whispers/nebula/src/branch/meow/nix/pkgs/rust-bootstrap. the code itself is pretty bad, but we've got some initial performance metrics.
.override { ... }, so this is the part we build right now in nixpkgs.(take these as order of magnitude estimates, the numbers are extremely noisy. build were run on several different days with other things running on my laptop.) so yeah. the start and end of the chain are expensive, and both are fairly constant cost. the intermediate versions have a relatively small linear coefficient, and we've done what we're aware of to make these builds do as little work as possible, but it's probably not small enough to be tenable as the distance between stable and what mrustc supports grows. | 18:40:11 | |
* (actually i lied, we can probably cut off a minute and a half from each of the intermediate builds, but we don't feel like looking more into bootstrap right now. but other than that, i think shaving off any further time from the intermediate builds would require diving deeper into small things like compiler flags with diminishing returns. (or you know. running on a faster machine)) | 18:51:30 | |
| hmm, any reason why each end is so long? is it just because optimizations and rust being "like that"(tm) | 19:33:33 | |
| would definitely be nice to reduce those as much as possible, especially 1.90 since that's bootstrapping-only | 19:33:54 | |
| the final step is a full stage 2 build which builds standard libraries for several targets, documentation, and several other things | 19:34:34 | |
| why are we building std for several targets? is that so it can include wasm std, or is that something we could disable? | 19:35:09 | |
| wasm and bfpel-* something, yeah | 19:35:23 | |
| I'm not entirely sure why the mrustc end is slow, but i think it mostly boils down to the fact that it's a two stage build. the first stage is just building rustc with mrustc, but i think this makes stage 2 pretty slow because rustc is fairly reliant on optimizations, which mrustc doesn't do much of | 19:36:38 | |
| but that's just my theory, i haven't looked into that side and there's a solid chance you could cut it down | 19:36:55 | |
| you could maybe amortize that cost across 1.90 and 1.91 by making "stage 2" just be building 1.91 (but you may be prone to miscompilation since mrustc isn't tested like that, i don't know) | 19:38:49 | |
okay you should be able to build without extra stdlibs by setting fastCross = true; in the final build derivation where you override rustc-unwrapped | 19:39:51 | |
| that also skips some other builds, quoting the code it "reuses the rustc from build" | 19:40:41 | |
| for comparison, each of the intermediate builds compiles six things: bootstrap, rustc, standard libraries, cargo, rust-installer, and generate-copyright (and I'll rip out those last two as soon as i next decide to look into it) | 19:40:37 | |
| https://github.com/NixOS/nixpkgs/blob/46db2e09e1d3f113a13c0d7b81e2f221c63b8ce9/pkgs/development/compilers/rust/rustc.nix#L39 | 19:40:45 | |
| we don't want to do that, that phase is what builds rustc. doing a stage 2 build (theoretically) gives us the best binary for building everything else with | 19:41:40 | |
| and is the "intended" way for rustc to be distributed | 19:41:57 | |
| * | 19:42:24 | |
| yeah fair | 19:42:40 | |
| i did notice some weird build steps, like that build logs say "Building stage2 compiler artifacts" with the same information two or three times, but i don't know if that's because the logging is lacking or something else. (that's not unique to this, you can see the same logs on hydra) | 19:44:07 | |
| * i did notice some weird build steps, like that build logs say "Building stage2 compiler artifacts" with the same information two or three times, but i don't know if that's because the logging is lacking or it's actually running duplicate builds. (that's not unique to this, you can see the same logs on hydra) | 19:44:27 | |
| * | 19:44:49 | |
| * | 19:44:59 | |
| * | 19:45:16 | |
| oh and stage 1 builds also break anything that links against rustc_private | 19:50:27 | |
| i don't remember the machinery involved with doing that (it might be nightly only?) so i don't know if anything in nixpkgs does that though | 19:51:03 | |
| * | 19:51:39 | |
| * | 19:53:04 | |