# johnthagen/min-sized-rust

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/johnthagen-min-sized-rust).**

9,782 stars · 247 forks · Rust · MIT

## Links

- GitHub: https://github.com/johnthagen/min-sized-rust
- awesome-repositories: https://awesome-repositories.com/repository/johnthagen-min-sized-rust.md

## Topics

`binary-size` `cargo` `containers` `lto` `no-std` `rust` `strip` `upx` `wasm`

## Description

This project is a collection of techniques and configurations for reducing the disk footprint of compiled Rust executables. It serves as a guide and toolset for binary size optimization, providing strategies to minimize the final executable size through compiler flags and configuration.

The project focuses on aggressive size reduction strategies, including recompiling the standard library from source to prune unused functions and implementing no-standard-library modes for memory-constrained environments. It details how to eliminate runtime overhead by removing standard library entry points and replacing stack unwinding with immediate abort strategies to remove backtrace metadata.

Additional capabilities cover binary bloat analysis to identify size-increasing dependencies, the use of link-time optimization to remove dead code, and post-compilation symbol stripping. The guide also addresses the reduction of storage footprints for applications deployed within container images and the use of external packing tools for binary compression.

## Tags

### Operating Systems & Systems Programming

- [Binary Size Reduction](https://awesome-repositories.com/f/operating-systems-systems-programming/assembly-metadata-editors/binary-size-reduction.md) — Implements various techniques to minimize the final executable size through release profiles and symbol stripping. ([source](https://github.com/johnthagen/min-sized-rust#readme))
- [Binary Bloat Analysis](https://awesome-repositories.com/f/operating-systems-systems-programming/binary-analysis-capabilities/binary-bloat-analysis.md) — Enables identification of functions, generic instantiations, and dependencies that contribute most to executable size. ([source](https://github.com/johnthagen/min-sized-rust#readme))
- [No-Std Environment Adapters](https://awesome-repositories.com/f/operating-systems-systems-programming/platform-development-integration/platform-support/environment-support-managers/no-std-environment-adapters.md) — Guides the creation of lightweight runtimes by removing standard library dependencies for memory-constrained environments. ([source](https://github.com/johnthagen/min-sized-rust/blob/main/no_std))

### Software Engineering & Architecture

- [Binary Footprint Optimizers](https://awesome-repositories.com/f/software-engineering-architecture/performance-reliability/performance-optimization/application-performance-tuning/application-performance-optimization/binary-footprint-optimizers.md) — Provides a comprehensive set of compiler flags and configurations to prioritize minimal binary footprint over execution speed. ([source](https://github.com/johnthagen/min-sized-rust#readme))
- [Link-Time Optimizations](https://awesome-repositories.com/f/software-engineering-architecture/compile-time-code-generation/link-time-optimizations.md) — Uses link-time optimization to analyze and remove dead code across compilation units to minimize binary size.
- [Debug Metadata Removal](https://awesome-repositories.com/f/software-engineering-architecture/metadata-attachments/binary-metadata/debug-metadata-removal.md) — Details how to strip file locations and formatting functions to reclaim space used by traceback information. ([source](https://github.com/johnthagen/min-sized-rust#readme))

### Part of an Awesome List

- [Standard Libraries](https://awesome-repositories.com/f/awesome-lists/devtools/standard-libraries.md) — Provides techniques to strip the standard library or restrict formatting utilities to achieve minimal binary size. ([source](https://github.com/johnthagen/min-sized-rust/blob/main/README.md))
- [Standard Library Optimizations](https://awesome-repositories.com/f/awesome-lists/devtools/standard-libraries/standard-library-optimizations.md) — Provides instructions for recompiling the standard library from source to prune unused functions and reduce binary size.
- [Usage Constraints](https://awesome-repositories.com/f/awesome-lists/devtools/polyfills/standard-library/usage-constraints.md) — Instructs how to avoid formatting code or substitute the base library with a minimal environment to decrease size. ([source](https://github.com/johnthagen/min-sized-rust#readme))

### Development Tools & Productivity

- [Debug Symbol Configurators](https://awesome-repositories.com/f/development-tools-productivity/debugging-profiling-testing/debugging-diagnostics/debugging-inspection-tools/debugging-and-inspection-tools/runtime-debugging/debug-symbol-configurators.md) — Sets up a pipeline to remove debug metadata and non-essential symbols from the binary after compilation.
- [Symbol Stripping](https://awesome-repositories.com/f/development-tools-productivity/debugging-profiling-testing/debugging-diagnostics/debugging-inspection-tools/debugging-and-inspection-tools/runtime-debugging/debug-symbol-configurators/symbol-stripping.md) — Details techniques for stripping debug symbols and metadata to reclaim storage space in the final binary.
- [Debug Symbol Stripping](https://awesome-repositories.com/f/development-tools-productivity/debugging-profiling-testing/debugging-diagnostics/debugging-inspection-tools/debugging-and-inspection-tools/runtime-debugging/debug-symbol-stripping.md) — Provides methods to remove non-essential symbol information from compiled binaries to reduce file size. ([source](https://github.com/johnthagen/min-sized-rust#readme))
- [Panic Handlers](https://awesome-repositories.com/f/development-tools-productivity/behavior-configuration/panic-handlers.md) — Reduces binary size by replacing stack unwinding with immediate aborts and stripping formatting details. ([source](https://github.com/johnthagen/min-sized-rust/blob/main/README.md))
- [Binary Bloat Analysis](https://awesome-repositories.com/f/development-tools-productivity/package-dependency-managers/dependency-bloat-reducers/binary-bloat-analysis.md) — Identifies which dependencies or functions increase final binary size to target specific areas for reduction.

### Programming Languages & Runtimes

- [Binary Size Optimizations](https://awesome-repositories.com/f/programming-languages-runtimes/binary-size-optimizations.md) — Provides comprehensive configurations and flags to reduce the size of compiled Rust executables.
- [Binary Bloat Analyzers](https://awesome-repositories.com/f/programming-languages-runtimes/language-ecosystems-tooling/programming-environments-tooling/rust-environments/binary-bloat-analyzers.md) — Provides methods for analyzing binary bloat and identifying the specific functions or dependencies that increase executable size.
- [Standard Library Size Optimizations](https://awesome-repositories.com/f/programming-languages-runtimes/performance-optimization-libraries/standard-library-size-optimizations.md) — Offers strategies to compile the base library from source with aggressive size-focused optimizations. ([source](https://github.com/johnthagen/min-sized-rust/blob/main/README.md))
- [Compilation Optimization Guides](https://awesome-repositories.com/f/programming-languages-runtimes/programming-language-varieties/programming-languages/systems-languages/rust/compilation-optimization-guides.md) — Provides instructions for optimizing the standard library and link-time optimization to minimize bloat.
- [No-Standard-Library Modes](https://awesome-repositories.com/f/programming-languages-runtimes/programming-utilities/standard-libraries/no-standard-library-modes.md) — Provides a guide for building lightweight runtimes by entirely removing the Rust standard library.
- [Custom Standard Library Builds](https://awesome-repositories.com/f/programming-languages-runtimes/standard-library-extensions/custom-standard-library-builds.md) — Provides instructions for recompiling the standard library from source to prune unused functions and reduce binary size. ([source](https://github.com/johnthagen/min-sized-rust#readme))
- [Program Entry Points](https://awesome-repositories.com/f/programming-languages-runtimes/program-entry-points.md) — Provides techniques to eliminate standard library boot-up sequences and runtime overhead at the program entry point.
- [Embedded Rust](https://awesome-repositories.com/f/programming-languages-runtimes/programming-language-varieties/programming-languages/systems-languages/rust/operating-systems/embedded-rust.md) — Supports building minimal Rust programs for bare-metal and memory-constrained environments.

### DevOps & Infrastructure

- [Image Slimming](https://awesome-repositories.com/f/devops-infrastructure/container-images/image-slimming.md) — Offers strategies for using specialized base images and slimming tools to reduce the footprint of deployed applications. ([source](https://github.com/johnthagen/min-sized-rust#readme))
- [Container Image Optimizers](https://awesome-repositories.com/f/devops-infrastructure/container-orchestration/image-management-tools/container-image-optimizers.md) — Provides guidance on using minification tools and minimal base images to shrink deployment footprints. ([source](https://github.com/johnthagen/min-sized-rust/blob/main/README.md))
- [Executable Compression Tools](https://awesome-repositories.com/f/devops-infrastructure/distribution-packaging/software-distribution/executable-compression-tools.md) — Utilizes external packing tools to compress compiled binaries and reduce their total disk footprint.

### Testing & Quality Assurance

- [Panic Strategy Configurations](https://awesome-repositories.com/f/testing-quality-assurance/software-testing/testing-frameworks/test-frameworks/execution-and-infrastructure/test-execution-runners/cli-test-runners/panic-strategy-configurations.md) — Implements an abort-on-panic strategy to eliminate the binary bloat caused by stack unwinding and backtrace metadata.
