r/rust • • Nov 17 '22

What are Rust’s biggest weaknesses?

What would you say are Rust’s biggest weaknesses right now? And are they things that can be fixed in future versions do you think or is it something that could only be fixed by introducing a breaking change? Let’s say if you could create a Rust 2.0 and therefore not worry about backwards compatibility what would you do different.

220 Upvotes

390 comments sorted by

View all comments

Show parent comment

2

u/LadulianIsle Nov 18 '22

This does impact final executable runtime speed, right? (Specifically for the number of jobs)

Something about optimizing code being compiled across threads?

4

u/[deleted] Nov 18 '22

[removed] — view removed comment

1

u/mindmaster064 Nov 18 '22

I haven't found much difference either way, personally. I usually follow the practice of using --jobs on dev and turn it off during release. But, most of the compiles will actually be on dev so this is a metrically huge time saver. Whether you use lld pre-post release is irrelevant, it's just faster linking and the output is identical.

Though admittedly the code path argument is redundant in a multi-threaded app, essentially you're undoing whatever optimizations you're doing there whenever you're adding threads to the mix. The compiler is simply unaware of your threads at compile time and has no knowledge of whatever it is doing is helping you or not. I'd argue than in most cases it probably isn't. So, YMMV, as always. But sitting around for 80% less time on a dev build is enough of a payday for me.

4

u/mindmaster064 Nov 18 '22

This is functionally equivalent to doing something like: 'make all -j $(nproc)' using a C type build system with make/configure. It has all of the same caveats/advantages. It has nothing to do with the runtime which would use whatever idea of the cores/threads your program is aware of. Remember 'cargo run' after the build is not in the compiler space anymore it's just running whatever is in the target directory for debug or release. The '--jobs' only speeds up what would happen if you run 'cargo build' or 'cargo build --release', essentially... If that is clear enough.