News for hackers. Stuff that matters.
Re:Rust Is Surprisingly Good as a Server Language by DougBTX on Monday July 13, 2020 @03:52AM (#23818232)
If it is a project you’ve recently built, it shouldn’t matter what’s in your cargo file, since none of that will change from build to build. I wonder what’s broken. How long does it take to build a new empty project?

One think that’s helped me stay “in the flow” is switching to rust-analyzer instead of the current official RLS. Much faster, I leave format on save turned on, so `cargo check` output is usually ready in about a quarter of a second after save.

Re:Rust Is Surprisingly Good as a Server Language by johnfn on Monday July 13, 2020 @03:59AM (#23818296)
A new empty project compiles in under a second. However, adding dependencies will add some arbitrary number to this. Additionally, every hundred lines of code seems to add some amount of time between half a second and a whole second. I did some reading and read that generics are particularly expensive to compile, so I wonder if that accounts for the variance. I can't explain why cargo deps add time, though.

I LOVE rust-analyzer. It's actually what got me to reconsider Rust after I tried a year or two ago, and it is SO good.

Re:Rust Is Surprisingly Good as a Server Language by steveklabnik on Monday July 13, 2020 @08:01AM (#23819805)
Let me put it a stronger way: if you're seeing your cargo dependencies recompile every time, it is a bug. Please file one upstream. These bugs do happen, but they are bugs.
Re:Rust Is Surprisingly Good as a Server Language by johnfn on Monday July 13, 2020 @01:33PM (#23823291)
I don't literally see my deps compile. It's just that compile time gets slower. (I wonder if it's related to the linker?) Is that still a bug? Would be happy to report it if so.
Re:Rust Is Surprisingly Good as a Server Language by estebank on Monday July 13, 2020 @02:31PM (#23823977)
If the slowless you're seeing is caused by the linker, which can very well be the case, consider using LLD as you can see significant speed improvements to the linking step.

https://github.com/rust-lang/rust/issues/39915#issuecomment-...

https://doc.rust-lang.org/1.22.0/unstable-book/compiler-flag...

If installed, you can run

    RUSTFLAGS="-Clink-arg=-fuse-ld=lld" cargo build --release
Re:Rust Is Surprisingly Good as a Server Language by johnfn on Monday July 13, 2020 @03:21PM (#23824530)
Looked into this :) unfortunately I run Mac so there's nothing I can do here. Tempted to dual boot Ubuntu, though.
Re:Rust Is Surprisingly Good as a Server Language by estebank on Monday July 13, 2020 @05:01PM (#23825515)
It's a shame. I'm on the same boat and not being able to use lld adds a literal minute to my builds :-/
Re:Rust Is Surprisingly Good as a Server Language by steveklabnik on Monday July 13, 2020 @02:10PM (#23823719)
Ahh.

I am less sure, but I would think that's expected, given that it has to link everything together into the final binary. You're gonna end up giving the linker more work to do, as you suspected.