Skip to content

ahaoboy/bloaty-metafile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

profile

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

csv format

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

Esbuild Bundle Size Analyzer

https://esbuild.github.io/analyze/

Generate image from json

You can use metafile-image implemented by nodejs to generate json files into image format, without manually uploading and screenshots

Usage

lock file

Because bloaty's output does not include crate dependency information, the sizes of crates are all displayed separately.

llrt-no-lock

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.

llrt-lock

deep

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

deep: 4, json: 6.7M llrt-deep-4

deep: 8, json: 12M llrt-deep-8

deep: 0(no limit), json: 80M llrt-deep-0

windows

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages