Bloaty
A tool for analyzing binary size and feature impact across Rust workspace members. Bloaty helps you understand how different features affect your binary sizes and identify potential optimization opportunities.
Features
- Analyze binary sizes across workspace members
- Compare feature impact on binary sizes
- Support for multiple output formats (text, JSON, JSONL)
- Integration with cargo-bloat, cargo-llvm-lines, and cargo-size
- Detailed reporting of size differences between features
Installation
Usage
Basic usage:
This will analyze all workspace members and generate reports in all supported formats.
Command Line Options
All list arguments (packages, skip-packages, skip-features, tool, output-format) support both comma-separated lists and multiple arguments.
-
-p, --package <PACKAGE>: Specify packages to analyze# Using comma-separated list # Using multiple arguments -
--skip-packages <SKIP_PACKAGES>: Packages to skip# Using comma-separated list # Using multiple arguments -
--skip-features <SKIP_FEATURES>: Features to skip# Using comma-separated list # Using multiple arguments -
-t, --tool <TOOL>: Tools to use (options: bloat, llvm-lines, size)# Using comma-separated list # Using multiple arguments -
--report-file <REPORT_FILE>: Custom report file name (without extension) -
--output-format <FORMAT>: Output format (text, json, jsonl, all)# Using comma-separated list # Using multiple arguments # Using 'all' for all formats
Examples
Analyze specific packages:
# Using comma-separated list
# Using multiple arguments
Skip certain features:
# Using comma-separated list
# Using multiple arguments
Use specific tools:
# Using comma-separated list
# Using multiple arguments
Generate specific output formats:
# Using comma-separated list
# Using multiple arguments
# Generate all formats
Custom report file:
Output Formats
Text Format
Human-readable format showing package, target, and feature sizes with differences.
Example:
Package: my_crate
===================
Target: my_target
-------------------
Base size: 1.2 MB
Feature: default | Size: 1.2 MB | Diff: +0 B
Feature: extra | Size: 1.5 MB | Diff: +300 KB
Feature: minimal | Size: 900 KB | Diff: -300 KB
JSON Format
Complete analysis in a single JSON object, useful for programmatic processing.
JSONL Format
Line-delimited JSON format, with each line representing a single event in the analysis process. Useful for streaming and real-time processing.
Example:
{"type":"package_start","name":"my_crate","timestamp":1234567890}
{"type":"target_start","package":"my_crate","target":"my_target","timestamp":1234567890}
{"type":"base_size","package":"my_crate","target":"my_target","size":1258291,"size_formatted":"1.2 MB","timestamp":1234567890}
{"type":"feature","package":"my_crate","target":"my_target","feature":"default","size":1258291,"diff":0,"diff_formatted":"+0 B","size_formatted":"1.2 MB","timestamp":1234567890}
Dependencies
- cargo-bloat
- cargo-llvm-lines
- cargo-size
Make sure these tools are installed before running bloaty: