4 ms·
> ore attention provided to things like Wasm than there is to things like embedded use cases for example. Things might be better, but last time I checked rust'
by Gibbon1 7y ago
> ore attention provided to things like Wasm than there is to things like embedded use cases for example.
Things might be better, but last time I checked rust's compiler was a lot slower than C and the binaries were several times bigger. That last one is a big deal for embedded.
- steveklabnik 7y agoYou can get Rust binaries just as small; the smallest known one was 145 bytes. Some defaults were recently adjusted to make them smaller by default too. https://github.com/tormol/tiny-rust-executable https://github.com/tormol/tiny-rust-executable
- dev_dull 7y agoNobody wants to play with their compiler to get a small binary. Languages are typically judged by their defaults. If rust can produce small binaries, then it must produce small binaries.
- vbezhenar 7y agoIf big binary works faster, I would prefer big binary any day. Nobody cares about disk size.
- na85 7y ago>Nobody cares about disk size. Embedded people care.
- shakna 7y agoAnd for most compilers, changing whether you care about binary size or performance, is a single switch away, not a series of enhancements you need to refer to a blog page to ensure you're doing it right.
- steveklabnik 7y agoRust does have the same switches C compilers have, that do the same things.
- steveklabnik 7y agoThe point is to demonstrate what's inherently overhead and what isn't. Rust has effectively the exact same inherent overhead as C does; that's the point. > Nobody wants to play with their compiler to get a small binary... If rust can produce small binaries, then it must produce small binaries. Everything is a tradeoff. Smaller binaries may or may not perform better than larger ones. This is something you need to play with, just like in C. If one single setting made everything the best in all circumstances, it wouldn't be a setting. C compilers have these settings too. > Languages are typically judged by their defaults. As I mentioned, the defaults have also been adjusted to help out too.
- deleted 7y ago[deleted]
- fluffything 7y ago> Languages are typically judged by their defaults. If rust can produce small binaries, then it must produce small binaries. Code size isn't the only axes that can be used to measure the quality of a binary, there are many others: like run-time performance, portability, debuggability, etc. No C compiler I know optimizes for size by default, in fact, I don't know of any C compiler that, by default, optimizes anything at all. Clang, GCC, MSVC, and all other mainstream compilers require users to enable optimizations (O1, O2, O3, Ofast, etc.) and none of these are code-size optimizations. Only relatively recently have compilers grown the ability to optimize for size, and you have to go way out of your way to do it (enable Oz, disable debug information -g0, enable LTO -flto, ...). Optimizing for size over anything else by default is one of the worst trade-offs a compiler can make. It's a bad trade-offs for most programs, and it is a bad-tradeoff for most compiler users.
- atoav 7y agoAnother consideration: Rust’s compiler is also slower because it does a lot more forces you to add error handling. In terms of real impact on developers I never felt it was dramatic. The rust language support in editors is so good that you will catch most errors before compiling. So once everything is dealt with you usually compile and it just works. Binary size is also one of these areas they are dealing with atm.
- swsieber 7y agoIt's also slower because it hands LLVM a boat-load of IR and relies on LLVM to optimize it (instead of doing it itself).
- Gibbon1 7y agoI've heard this is mostly the answer. Which makes me assume that the LLVM is a bad match for rust's backend requirements.
- pjmlp 7y agoSo how come Ada, Delphi, C++ Builder, VC++, .NET Native, D compilers happen to be much faster?