i ran through the rust “getting started” page (https://www.rust-lang.org/learn/get-started). it's a hello-world project that has the rust crab mascot say hello, and consists of 10 lines of code actually written.
it results in pulling in 25 separate dependencies totalling up to 97 megabytes.
for reference the entire cowsay source is 168 lines/4 kilobytes of perl.
@nytpu True, it's not an apples to apples comparison. I didn't try to exclude perl packages I never explicitly installed. So, does the resulting executable need all 97MB? Or is that just from all the build cruft?
(And I don't mean to bother you. I've been meaning to go and learn some Rust, so maybe I should go do that now and not pester somebody on the internet.)
@cstanhope This was a while ago so I don't remember in this particular case, but I presume rust's linker would be smart enough to strip out all the unused cruft. Rust does make huge executables though, even when stripped, and I really can't figure out why. Unstripped Go binaries with debug symbols and with the full Go runtime and everything are much smaller than a stripped rust binary (and rust doesn't have a runtime)
I've written about this before funnily enough: https://nytpu.com/gemlog/2021-04-13.gmi
@nytpu Oh geez. I didn't see the date of the post I was replying to. Sorry to jump on an old post. Thanks for the additional info. I'm digging in now for myself. It looks like the resulting release binary is around 413kB, with dynamic dependencies of libs: gcc, pthread, dl, c, and ld-linux-x86-64.
The debug build is about 1MB.
Thanks for the kind response and link, and thanks for the prompt to finally tentatively start exploring rust. :)
@cstanhope @nytpu Doesn't answer the original question, but Rust has been used for a winning 4k intro:
So it's not like it can't be small, it's just that the package ecosystem has issues.
The bigger issue to me is that if you build a different executable, all the shared dependencies are compiled again. Compiling any Rust package on Guix is a bit of a nightmare.
The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!