找出占用您可执行文件大部分空间的内容。
Find out what takes most of the space in your executable.
Supports ELF (Linux, BSD), Mach-O (macOS) and PE (Windows) binaries.
WASM is not supported. Use twiggy instead.
Inspired by google/bloaty.
cargo install cargo-bloator
cargo install cargo-bloat --no-default-featuresif you don't need regex filtering using the --filter option.
Get a list of the biggest functions in the release build:
…Get a list of the biggest dependencies in the release build:
% cargo bloat --release --crates
Compiling ...
Analyzing target/release/cargo-bloat
File .text Size Crate
8.1% 61.2% 231.5KiB std
2.5% 19.2% 72.4KiB cargo_bloat
1.2% 9.4% 35.5KiB [Unknown]
1.0% 7.2% 27.2KiB json
0.3% 2.2% 8.5KiB pico_args
0.1% 0.4% 1.7KiB multimap
0.0% 0.3% 1.1KiB memmap
0.0% 0.0% 175B term_size
0.0% 0.0% 45B time
13.3% 100.0% 378.0KiB .text section size, the file size is 2.8MiB
Note: numbers above are a result of guesswork. They are not 100% correct and never will be.Get a list of the biggest functions in the release build filtered by the regexp:
Note: you have to build cargo-bloat with a regex-filter feature enabled.
…Flags specific for cargo-bloat:
--crates Per crate bloatedness
--filter <CRATE|REGEXP> Filter functions by crate
--split-std Split the 'std' crate to original crates like core, alloc, etc.
--no-relative-size Hide 'File' and '.text' columns
--full-fn Print full function name with hash values
-n <NUM> Number of lines to show, 0 to show all [default: 20]
-w, --wide Do not trim long function names
--message-format <FMT> Output format [default: table] [possible values: table, json]cargo-bloat is licensed under the MIT license.
暂无开放 Issues,或尚未同步最近议题。