bloaty-metafile is a cli tool to convert csv files generated by bloaty to esbuild's metafile format, so that you can use online tools to analyze the size of the program
cargo binstall bloaty-metafile
# or install from github
cargo install --git https://github.com/ahaoboy/bloaty-metafile
# https://github.com/google/bloaty/blob/main/doc/using.md
bloaty ./bloaty -d sections,symbols -n 0 --csv | bloaty-metafile > meta.json
bloaty-metafile meta.csv > meta.json
bloaty ./target/release/bloaty-metafile -d sections,symbols -n 0 --csv | bloaty-metafile --name=bloaty-metafile --lock=Cargo.lock > meta.json
In order for bloaty to parse symbol information properly, it is recommended to keep debug information and turn off lto and strip
[profile.bloaty]
debug = true
lto = false
strip = false
inherits = 'release'
cargo build --profile bloaty
bloaty ./target/bloaty/bloaty-metafile -d sections,symbols -n 0 --csv > meta.csv
bloaty-metafile meta.csv --deep=0 > meta.json
Please make sure bloaty generates a csv file in the following format. If the program is too large and the generated json exceeds 100mb, use the -n parameter to reduce the amount of data.
sections,symbols,vmsize,filesize
.text,ossl_aes_gcm_encrypt_avx512,337642,337642
.text,ossl_aes_gcm_decrypt_avx512,337638,337638
https://esbuild.github.io/analyze/
You can use metafile-image implemented by nodejs to generate json files into image format, without manually uploading and screenshots
Because bloaty's output does not include crate dependency information, the sizes of crates are all displayed separately.
If a lock file can be provided, by default, the Cargo.lock file in the current directory is used. the dependency size can be correctly displayed by analyzing the crate dependencies.
For large applications, the dependency tree will be very deep, which will cause the generated JSON to be very large and contain too much useless information. You can use the --deep option to limit the maximum depth of the dependency.
The default value of deep is 8, which is probably suitable for most programs. 0 means no limit
bloaty: PE doesn't support this data source
bloaty-metafile just converts the csv output by bloaty to json. You can generate csv files on other platforms with bloaty, and then convert them on windows.