Live data from Hacker News

Why is my Rust build so slow?

fasterthanli.me

211–217 of 217 posts

Re: Why is my Rust build so slow?

#211
post #155

Earlier quoted context omitted.

Tokio maintainer here. I've actually been spending a bunch of time recently looking in to how we can reduce Tokio's compile-times. I haven't really been able to find any big wins yet, but one thing has been pretty clear from the benchmarks: The number of dependencies of Tokio is not the problem. They all compile pretty fast and can all compile in parallel. Tokio itself takes a lot longer than the dependencies. (Excep…

Macros. This is a major pain. I wish it get more attention (and hopefully: How about a SINGLE way to do macros? Like zig?). Serde is another killer on compiling speed.

Well, one of the advantages of having two ways to do macros is that macro_rules! macros are much much faster than procedural macros.

Re: Why is my Rust build so slow?

#212

Earlier quoted context omitted.

Here's my edit-compile-run cycle in dev configuration: https://streamable.com/az397y I use Qt, boost, lots of templates. - clang as a compiler - mold as a linker - PCH (easy with cmake) - plugin architecture for the software ; plugins are dynamic libraries when developing (everything is linked statically for releases which take of course much longer to build with lto, etc.) - building on Linux (it's seriously slower…

Which editor is this?

Qt Creator I believe? Not 100% sure.

Re: Why is my Rust build so slow?

#213
post #144

Earlier quoted context omitted.

Here's my edit-compile-run cycle in dev configuration: https://streamable.com/az397y I use Qt, boost, lots of templates. - clang as a compiler - mold as a linker - PCH (easy with cmake) - plugin architecture for the software ; plugins are dynamic libraries when developing (everything is linked statically for releases which take of course much longer to build with lto, etc.) - building on Linux (it's seriously slower…

Disabling Windows Defender in your build directories can be a serious boost. NTFS is still slow, though.

You can also disable Windows Defender for the build process, for example disabling it for devenv.exe makes Visual Studio builds waaaaaay faster!

Re: Why is my Rust build so slow?

#214
post #155

Earlier quoted context omitted.

Macros. This is a major pain. I wish it get more attention (and hopefully: How about a SINGLE way to do macros? Like zig?). Serde is another killer on compiling speed.

Well, one of the advantages of having two ways to do macros is that macro_rules! macros are much much faster than procedural macros.

Yeah, but then why not make it the only one? One reason is that proc-macros can "see" the syntax outside the point of declaration(or enclosed). This means you must do macro_rules! {struct.... } instead of declare the struct first then forward it.

Re: Why is my Rust build so slow?

#215
post #139

Earlier quoted context omitted.

Including me! There’s a lot of daylight between “an old dual core laptop” and a last gen thread ripper. For example, I’m running on a quad core i7 from 2015.

My old dual core laptop from 2009 works just fine with Visual Studio 2022, even though I wasn't the OP. And long compile times kill the battery on the go, and cargo check hardly helps when writing GUI code.

Your laptop from 2009 predates even Rust's earliest stable version by 6 years. Including computers that are older than the language itself is completely unreasonable.

Re: Why is my Rust build so slow?

#216
post #46

This much complexity and the tribal knowledge required to bypass it, so early in the the life of a programming language, is a really bad sign. It means the complexity of the problem space is not solved by the language, and the responsibility of solving it is being passed on to the users. You might react to this by saying that slow build times are not a big deal. That's a mistake -- iteration is key to productivity an…

Rust seems to have inherited two favorite C++ development process features: long compilation times and incomprehensible error messages that aren't really related to the actual issue (e.g. just how C++ barfed out a bunch of template errors, borrow checker really loves to barf out very obscure error messages when there's an issue with lifetimes).

Rust has some of the best compiler error messages out there so not sure what you're talking about there. And C++'s compiler error message issue stopped being an issue since like GCC 4.

Re: Why is my Rust build so slow?

#217

Earlier quoted context omitted.

A 'moral' justification is not needed. We are talking about potentially massive build speed improvement here. Sounds like it could just be a build setting.

It would definitely be interesting to run some experiments with automatically splitting up Rust crates into compilation units if possible.

Username checks out :-)
Post reply on HN