this post was submitted on 12 Jun 2020
1 points (100.0% liked)

Rust Programming

8438 readers
27 users here now

founded 5 years ago
MODERATORS
 

All these tests are run on Lemmy tag v0.6.74, using cargo build --release.

  • Normal release build: 19mb
  • After running strip 13mb
  • Setting opt-level=z (optimize binary size): 21mb
  • Optimize for size + strip: 13mb
  • Optimize for size + enable link-time optimization: 14mb
  • Optimize for size + lto + strip: 14mb
  • only lto: 15mb
  • lto + strip: 11mb
  • lto + strip + reduce codegen-units: 11mb

Check this document for a detailed explanation of these options

Based on these numbers and the difference in compile time between options (which I didnt record), lto + strip looks like the best option to me.

This is also useful: https://github.com/johnthagen/min-sized-rust

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here