News for hackers. Stuff that matters.
Re:Improving Rust compile times to enable adoption of memory... by kibwen on Friday February 03, 2023 @09:28AM (#34641406)
> On my 1240p if I change one file and build it takes ~11s to build. Changing one file and running tests takes ~3.5

`cargo test` and default `cargo build` use the same profile, so presumably the first number is referring to `cargo build --release`. Release builds deliberately forego compilation speed in favor of optimization. In practice, most of my development involves `cargo check`, which is much faster than `cargo build`.

Re:Improving Rust compile times to enable adoption of memory... by dmm on Friday February 03, 2023 @10:31AM (#34642350)
> so presumably the first number is referring to `cargo build --release`

Both numbers are for debug builds. I don't know why `cargo test` is faster but I appreciate it.

Incremental release builds with `cargo build --release` are even slower taking ~35s on the 1240p.

Re:Improving Rust compile times to enable adoption of memory... by dureuill on Friday February 03, 2023 @04:47PM (#34648176)
i suspect most of that time is link time. Possibly the linker in use is not very parallel, and so linking one big executable with cargo build takes longer than many smaller test executable whose linking can actually be made parallel?
Re:Improving Rust compile times to enable adoption of memory... by scns on Saturday February 04, 2023 @04:39AM (#34653145)
Re:Improving Rust compile times to enable adoption of memory... by kibwen on Friday February 03, 2023 @05:50PM (#34648921)
Honestly, it should be impossible; in the absence of some weird configuration, cargo test does strictly more work than cargo build. :P Can you reproduce it and file a bug?