I am sure it can be trimmed, but we are getting oblivious to common sense a little. This is system language.
I am sure it can be trimmed, but we are getting oblivious to common sense a little. This is system language.
The size is due to a statically linked stdlib (also jemalloc, which you can decide not to use) -- your C program is tiny because your system has a stdlib it can dynamically link to. Rust can do this too, it's just not the default since in most cases this additive extra binary size isn't a problem.
Being a systems language does mean we should forgo sensible defaults.
https://github.com/japaric/rust-on-openwrt/issues/1#issuecom...
https://github.com/japaric/std-with-cargo#making-rust-binari...
Binary size is not a major concern for most programs, even those written in a systems language. If it is a concern for your use case, you can use dynamic linking and the system allocator to get the size down to the same scale as C.
$ cat hello.rs
fn main() { println!("Hello, world!") }
$ rustc hello.rs -C prefer-dynamic
$ ./hello
Hello, world!
$ ls -al hello
-rwxrwxr-x 1 lifthrasiir 9064 Mar 4 14:24 hello*
See other comments for the explanation.