3 ms·
There's a lot that can be done to shrink a Rust binary[0]. A copy of the summary: - Compile with --release. - Before distribution, enable LTO and strip the bi
by timlyo 8y ago
There's a lot that can be done to shrink a Rust binary[0]. A copy of the summary:
- Compile with --release.
- Before distribution, enable LTO and strip the binary.
- If your program is not memory-intensive, use the system allocator (assuming nightly).
- You may be able to use the optimization level s/z in the future as well.
- I didn’t mention this because it doesn’t improve such a small program, but you can also try UPX and other executable compressors if you are working with a much larger application.
[0]https://lifthrasiir.github.io/rustlog/why-is-a-rust-executable-large.html https://lifthrasiir.github.io/rustlog/why-is-a-rust-executab...
- steveklabnik 8y agos/z was made stable ten days ago: https://github.com/rust-lang/rust/pull/50265 https://github.com/rust-lang/rust/pull/50265 So, two releases :)