4 ms·
Not to mention binary size too. The same program written in Rust can be magnitudes larger in binary size[1], which is a complete non-starter for many embedded
by Alupis 6y ago
Not to mention binary size too.
The same program written in Rust can be magnitudes larger in binary size[1], which is a complete non-starter for many embedded projects (where a lot of C/C++ code is destined to live).
[1] https://dev.to/aakatev/executable-size-rust-go-c-and-c-1bna https://dev.to/aakatev/executable-size-rust-go-c-and-c-1bna
- qw3rty01 6y agoIt's a bit unfair to use a default hello world program as an argument for why binaries are too large to use in an embedded context, because rust binaries can be made very small with tuning[1][2][3]. [1] https://www.codeslow.com/2019/12/tiny-windows-executable-in-rust.html https://www.codeslow.com/2019/12/tiny-windows-executable-in-... [2] https://github.com/johnthagen/min-sized-rust https://github.com/johnthagen/min-sized-rust [3] https://rust-embedded.github.io/book/unsorted/speed-vs-size.html https://rust-embedded.github.io/book/unsorted/speed-vs-size....
- zozbot234 6y agoSee https://news.ycombinator.com/item?id=23496107 https://news.ycombinator.com/item?id=23496107 which links a number of rather detailed articles discussing Rust binary sizes.
- dthul 6y agoIt seems like this blog post is not very well thought out. At least the Rust version was compiled in debug mode, binaries were not stripped, the size-optimizing compiler profile was not used and neither was LTO. This repository contains information on how to achieve small Rust binaries: https://github.com/johnthagen/min-sized-rust https://github.com/johnthagen/min-sized-rust
- saagarjha 6y agoSome of those are useful, many are absolutely awful from the viewpoint of leaving in debugability.
- Alupis 6y agoAnd will anyone recognize all the absurd amount of hoops you must jump through to get small binaries with Rust? Some of which, as you said, remove features that are needed like debugging symbols.
- dthul 6y agoWhat's the difference to C++? Building with (the equivalent of) -Os, using LTO and stripping binaries are common approaches for reducing binary size, I don't see how this is absurd.
- Alupis 6y agoThose things can be used to produce smaller c++ binaries. Without doing a single thing, though, c++ binaries are tiny compared to a rust binary. That's the difference. To achieve small binaries with rust, one must remove nearly all the advantages of rust, including the self contained stdlib, debugging capabilities, and even runtime memory safety. What's even the point of using rust then?