!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

674 Members
Rust154 Servers

Load older messages


SenderMessageTime
29 Mar 2026
@whispers:catgirl.cloudwhispers [& it/fae] (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
@whispers:catgirl.cloudwhispers [& it/fae] 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.

  • reference for build perf on my laptop: nom-build -A rustc-unwrapped --check on master: 1h52m17s

  • mrustc: 5m2s

  • minicargo: unused. i can't find a way to get it to apply the right flags while building, so it just gets built as part of the next step.

  • rust-1_90_0: 1h54m18s

* this is fully using mrustc's build system. i haven't tried to optimize it at all, but i suspect you could get at least a little better perf out of it with some work.
  • rust-1_91_1: 17m33s

  • rust-1_92_0: 18m53s

  • rust-1_93_1: 18m1s

  • rustc-1_94_0: 1h48m52s

* this is just rustc-unwrapped with .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
@whispers:catgirl.cloudwhispers [& it/fae] (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
@whispers:catgirl.cloudwhispers [& it/fae] 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.

  • reference for build perf on my laptop: nom-build -A rustc-unwrapped --check on nixpkgs master: 1h52m17s

  • mrustc: 5m2s

  • minicargo: unused. i can't find a way to get it to apply the right flags while building, so it just gets built as part of the next step.

  • rust-1_90_0: 1h54m18s

* this is fully using mrustc's build system. i haven't tried to optimize it at all, but i suspect you could get at least a little better perf out of it with some work.
  • rust-1_91_1: 17m33s

  • rust-1_92_0: 18m53s

  • rust-1_93_1: 18m1s

  • rustc-1_94_0: 1h48m52s

* this is just rustc-unwrapped with .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
@whispers:catgirl.cloudwhispers [& it/fae] * (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
@pyrox:pyrox.devdish [Fox/It/She]hmm, any reason why each end is so long? is it just because optimizations and rust being "like that"(tm)19:33:33
@pyrox:pyrox.devdish [Fox/It/She]would definitely be nice to reduce those as much as possible, especially 1.90 since that's bootstrapping-only19:33:54
@whispers:catgirl.cloudwhispers [& it/fae]the final step is a full stage 2 build which builds standard libraries for several targets, documentation, and several other things19:34:34
@pyrox:pyrox.devdish [Fox/It/She]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
@whispers:catgirl.cloudwhispers [& it/fae]wasm and bfpel-* something, yeah19:35:23
@whispers:catgirl.cloudwhispers [& it/fae] 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
@whispers:catgirl.cloudwhispers [& it/fae]but that's just my theory, i haven't looked into that side and there's a solid chance you could cut it down19:36:55
@whispers:catgirl.cloudwhispers [& it/fae]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
@pyrox:pyrox.devdish [Fox/It/She] 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
@pyrox:pyrox.devdish [Fox/It/She]that also skips some other builds, quoting the code it "reuses the rustc from build"19:40:41
@whispers:catgirl.cloudwhispers [& it/fae]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
@pyrox:pyrox.devdish [Fox/It/She] https://github.com/NixOS/nixpkgs/blob/46db2e09e1d3f113a13c0d7b81e2f221c63b8ce9/pkgs/development/compilers/rust/rustc.nix#L39 19:40:45
@whispers:catgirl.cloudwhispers [& it/fae]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 with19:41:40
@whispers:catgirl.cloudwhispers [& it/fae]and is the "intended" way for rustc to be distributed19:41:57
@whispers:catgirl.cloudwhispers [& it/fae] * 19:42:24
@pyrox:pyrox.devdish [Fox/It/She]yeah fair19:42:40
@whispers:catgirl.cloudwhispers [& it/fae] 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
@whispers:catgirl.cloudwhispers [& it/fae] * 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
@whispers:catgirl.cloudwhispers [& it/fae] * 19:44:49
@whispers:catgirl.cloudwhispers [& it/fae] * 19:44:59
@whispers:catgirl.cloudwhispers [& it/fae] * 19:45:16
@whispers:catgirl.cloudwhispers [& it/fae]oh and stage 1 builds also break anything that links against rustc_private19:50:27
@whispers:catgirl.cloudwhispers [& it/fae]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 though19:51:03
@whispers:catgirl.cloudwhispers [& it/fae] * 19:51:39
@whispers:catgirl.cloudwhispers [& it/fae] * 19:53:04

Show newer messages


Back to Room ListRoom Version: 6