3 ms·
Good points, but I'd like to point out that nothing on this post is Rust-specific. You can have the same issue if programming in any other language, including
by ameixaseca 7y ago
Good points, but I'd like to point out that nothing on this post is Rust-specific.
You can have the same issue if programming in any other language, including C: excessive indirections, inefficient algorithms, bad abstractions, excessive use of unnecessary libraries, etc.
It's indeed easier to "bloat" your resulting binary in C++ or Rust given the easiness to do higher-level abstractions; since you can more easily program complex solutions you also need to consider your design and the trade-offs on your code.
I'd also like to point out that, in comparison:
* Rust bloat is a speck compared to hundreds of megabytes for a similar Python program + runtime including the same amount of code.
* Rust bloat can be mostly optimized away for systems that really care about excess/unused code - you have #![no_std], disabling of backtraces, aborting on panic, and a lot of other optimizations that throw away a big portion of extra functionality not needed for things like embedded. You have little alternative on things like Go besides removing debugging symbols and doing tricks like "dynamic decompression" (which could also be applied to Rust programs to further reduce their size, btw).
Bottom line is: Rust makes it easier for you to "just add a new library" and it also make you more mindful of the bloat, but we need to keep it in perspective.