Boshen/cargo-bsize

Investigate Rust binary size

Rust

74

101 commits

updated Aug 26, 2026

See the code

README

cargo-bsize

Analyze Rust binary size.

Install

cargo binstall cargo-bsize

Use

cargo bsize
cargo bsize --cdylib rolldown_binding path/to/rolldown
cargo bsize --staticlib my_ffi_lib path/to/project

A staticlib is an archive of unlinked objects, so it is first linked into a shared library with cc (every member kept, dead code stripped, symbols the host provides left unresolved) and that is what gets analyzed.

The output is a Markdown report that can be fed into an agent. It shows:

  • Binary size by object-file section
  • Linker input, archive-member, and exported-root provenance
  • Code size by Rust function
  • Static data size
  • Rust type layout
  • Code size by crate
  • Code size by generic monomorphization
  • Duplicate Cargo dependencies
  • Duplicate function bodies
  • Duplicate static data
  • Repeated string literals
  • Inlined Rust code
  • LLVM inlining, instruction-growth, and stack-frame decisions
  • Panic-path overhead
  • Unwind frame and exception-cleanup ownership
  • Rust formatting overhead
  • Trait-object dynamic dispatch
  • Assembly instruction patterns
  • Rust source-line attribution
  • Assembly and input-object reference graph with root/API retention, shared cohorts, coverage gains, and shortest why-live paths
  • Ranked graph-coverage gaps and likely missing entries
  • And more.

Prior art

Sponsors

Sponsors

Project health

crates.io

Latest release

0.0.2 · Aug 19, 2026

Releases this year

2

Significant stargazers

John-David Dalton

5,602 followers · starred Aug 2026

MK (fengmk2)

8,408 followers · starred Aug 2026

Connor Shea

155 followers · starred Aug 2026

DaniPopes

1,052 followers · starred Aug 2026

Boshen/cargo-bsize

Investigate Rust binary size

Rust

74

101 commits

updated Aug 26, 2026

See the code

README

cargo-bsize

Analyze Rust binary size.

Install

cargo binstall cargo-bsize

Use

cargo bsize
cargo bsize --cdylib rolldown_binding path/to/rolldown
cargo bsize --staticlib my_ffi_lib path/to/project

A staticlib is an archive of unlinked objects, so it is first linked into a shared library with cc (every member kept, dead code stripped, symbols the host provides left unresolved) and that is what gets analyzed.

The output is a Markdown report that can be fed into an agent. It shows:

  • Binary size by object-file section
  • Linker input, archive-member, and exported-root provenance
  • Code size by Rust function
  • Static data size
  • Rust type layout
  • Code size by crate
  • Code size by generic monomorphization
  • Duplicate Cargo dependencies
  • Duplicate function bodies
  • Duplicate static data
  • Repeated string literals
  • Inlined Rust code
  • LLVM inlining, instruction-growth, and stack-frame decisions
  • Panic-path overhead
  • Unwind frame and exception-cleanup ownership
  • Rust formatting overhead
  • Trait-object dynamic dispatch
  • Assembly instruction patterns
  • Rust source-line attribution
  • Assembly and input-object reference graph with root/API retention, shared cohorts, coverage gains, and shortest why-live paths
  • Ranked graph-coverage gaps and likely missing entries
  • And more.

Prior art

Sponsors

Sponsors

Project health

crates.io

Latest release

0.0.2 · Aug 19, 2026

Releases this year

2

Significant stargazers

John-David Dalton

5,602 followers · starred Aug 2026

MK (fengmk2)

8,408 followers · starred Aug 2026

Connor Shea

155 followers · starred Aug 2026

DaniPopes

1,052 followers · starred Aug 2026