Making Rust binaries smaller by default

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • min-sized-rust

    🦀 How to minimize Rust binary size 📦

  • It's really a shame that Rust includes the stdlib piecemeal in binary form, debug symbols and all, in every resulting binary.

    I do love Rust but binary sizes have always annoyed me greatly and I always had this nagging feeling that part of all programmers don't rake Rust seriously because of that. And I actually have witnessed, several times in the last 2-ish years, older-school programmers berate and ignore Rust on that basis alone (so the author is quite right to call this out as a factor).

    Looking at the https://github.com/johnthagen/min-sized-rust repo, final binary size of 51 KB when compilation / linking / stripping takes stdlib into account (and not just blindly copy-pasting the 4MB binary blob) is acceptable and much more reasonable. I wouldn't care for further micro-optimizations e.g. going to 20KB or even 5KB (further down the README file).

    I also don't use nightly in my Rust work so I guess I'll have to wait several more years. :(

  • Cargo

    The Rust package manager

  • Yes, I am sure this is going to be a part of Rust 1.77.0 and it will release on 21st March. I say that because of the tag in the PR (https://github.com/rust-lang/cargo/pull/13257#event-11505613...).

    I'm no expert on Rust compiler development, but my understanding is that all code that is merged into master is available on nightly. If they're not behind a feature flag (this one isn't), they'll be available in a full release within 12 weeks of being merged. Larger features that need a lot more testing remain behind feature flags. Once they are merged into master, they remain on nightly until they're sufficiently tested. The multi-threaded frontend (https://blog.rust-lang.org/2023/11/09/parallel-rustc.html) is an example of such a feature. It'll remain nightly only for several months.

    Again, I'm not an expert. This is based on what I've observed of Rust development.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • rust

    Empowering everyone to build reliable and efficient software.

  • It's funny that it was already considered be “only pay for what you use” when the binaries contained half of H. P. Lovecraft's œuvre.

    See issue #13871

    https://github.com/rust-lang/rust/issues/13871

    I exaggerate, point is that we've come a long way and are still getting better.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • You can't do that because I hate you

    9 projects | news.ycombinator.com | 28 Dec 2023
  • Is there something "different" about Cargo's resolver in GitHub Actions?

    3 projects | /r/rust | 27 Jun 2023
  • Sudden 99% + Build Time Improvement Going from 1.66.1 to 1.71.0

    3 projects | /r/rust | 3 May 2023
  • Is it possible to make Rust Foundation powerless? Or to dismantle it?

    2 projects | /r/rust | 8 Apr 2023
  • Does Cargo's new sparse protocol save our disk space?

    2 projects | /r/rust | 11 Mar 2023