Re:Rust – Faster compilation with the parallel front-end in ...
by lucasyvas on Friday November 10, 2023 @08:17AM
(#38218419)
As someone who has only done small projects in Rust, I'm curious how many LoC are we're talking? And were you splitting your project into crates where it made sense?
[ Parent
| on HN ]
Re:Rust – Faster compilation with the parallel front-end in ...
by insanitybit on Friday November 10, 2023 @08:51AM
(#38218767)
We split each service into crates, plus some libraries. There were some native dependencies as well, which could really impact compile times, as well as some codegen for things like protobuf.
From a quick tokei, looks like 49kloc of Rust.
Re:Rust – Faster compilation with the parallel front-end in ...
by eminence32 on Friday November 10, 2023 @08:51AM
(#38218775)
One thing I've observed is that every smallish projects (~10k LoC) can take a while to build if you're working on slow network filesystems.
When using local disks, a 10k LoC project takes ~5 seconds to build
When using network FS, the same project takes ~23 seconds to build
Re:Rust – Faster compilation with the parallel front-end in ...
by the8472 on Friday November 10, 2023 @09:50AM
(#38219521)
That doesn't seem particularly surprising. Lots of software is slow when your storage is slow.
Re:Rust – Faster compilation with the parallel front-end in ...
by eminence32 on Friday November 10, 2023 @11:15AM
(#38220648)
You're right that some slowdown is expected, but for me personally I hadn't realized how bad this particular FS was, nor had I expected how much it impacted build times
Re:Rust – Faster compilation with the parallel front-end in ...
by lolinder on Friday November 10, 2023 @09:54AM
(#38219573)
Wouldn't this be true of any compiler? Do other compilers have optimizations that avoid excess disk usage when on a slow file system?
Re:Rust – Faster compilation with the parallel front-end in ...
by eminence32 on Friday November 10, 2023 @11:03AM
(#38220500)
Yes, I think that's right, but I don't have any data to compare rust to other compilers.
Re:Rust – Faster compilation with the parallel front-end in ...
by ragnese on Friday November 10, 2023 @11:31AM
(#38220866)
I wouldn't be surprised if Rust/Cargo does more disk IO than other build tools, though. Rust does a lot of compile time code gen and caches a lot of stuff on disk.
Re:Rust – Faster compilation with the parallel front-end in ...
by insanitybit on Friday November 10, 2023 @10:31AM
(#38220074)
FWIW we did this to significantly reduce storage usage
strip = "debuginfo"
This was a ~20x reduction in size, 279M -> 19M. If you have slow storage it could really help performance (don't recall, personally).
Re:Rust – Faster compilation with the parallel front-end in ...
by eminence32 on Friday November 10, 2023 @10:57AM
(#38220432)
Good hint, thank you. I'm trying this out and I do see an improvement in performance. The ~23 second build now takes about ~14 seconds
Re:Rust – Faster compilation with the parallel front-end in ...
by insanitybit on Friday November 10, 2023 @12:27PM
(#38221682)
Hell yeah! I'm so glad I could help, that's a big win.
FWIW it does break debuggers since you won't have the symbols. Just comment it out when you need a build that has all of that info.