Analyze Rust binary size.
cargo binstall cargo-bsizecargo bsize
cargo bsize --cdylib rolldown_binding path/to/rolldown
cargo bsize --staticlib my_ffi_lib path/to/projectA 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.