Just having found Rust and having read the first two chapters of the documentation, I find the approach and the way they defined the language particularly interesting. So I
For an overview of all of the ways to reduce the size of a Rust binary, see the min-sized-rust repository.
The current high level steps to reduce binary size are:
jemalloc by default)[profile.release]
opt-level = 'z' # Optimize for size.
lto = true # Enable Link Time Optimization
codegen-units = 1 # Reduce number of codegen units to increase optimizations.
panic = 'abort' # Abort on panic
cargo build --releaseThere is more that can be done using nightly Rust, but I'll leave that information in min-sized-rust as it changes over time due to the use of unstable features.
You can also use #![no_std] to remove Rust's libstd. See min-sized-rust for details.