Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The crate produce very big binary size #69

Open
RCasatta opened this issue Jan 19, 2024 · 2 comments
Open

The crate produce very big binary size #69

RCasatta opened this issue Jan 19, 2024 · 2 comments

Comments

@RCasatta
Copy link
Collaborator

Just wanted to report that in a downstream lib elements-miniscript is the biggest contributor in binary size, maybe because it uses a lot of generics:

$ cargo bloat --release --crates
 File  .text     Size Crate
 9.6%  29.9%   1.9MiB elements_miniscript
 6.7%  21.0%   1.3MiB wollet
 4.2%  12.9% 833.4KiB std
 1.9%   6.0% 388.4KiB elements
 1.8%   5.7% 365.4KiB serde_cbor
 1.6%   5.1% 328.8KiB [Unknown]
 1.3%   4.1% 266.4KiB rustls
 0.9%   2.9% 185.3KiB ring
 0.7%   2.1% 138.5KiB electrum_client
 0.4%   1.2%  78.0KiB simplicity
 0.3%   1.0%  65.9KiB serde_json
 0.3%   1.0%  64.2KiB bitcoin_hashes
 0.3%   0.8%  53.0KiB signer
 0.2%   0.7%  43.7KiB bitcoin
 0.1%   0.4%  26.9KiB uniffi_core
 0.1%   0.4%  26.1KiB secp256k1_sys
 0.1%   0.4%  25.0KiB miniscript
 0.1%   0.4%  24.7KiB ks_bindings
 0.1%   0.3%  19.3KiB secp256k1_zkp_sys
 0.1%   0.3%  17.2KiB bip39
 0.6%   2.0% 129.8KiB And 41 more crates. Use -n N to show more.
32.2% 100.0%   6.3MiB .text section size, the file size is 19.6MiB
$ cargo bloat --release -n 10
 File  .text    Size               Crate Name
 0.2%   0.7% 45.6KiB elements_miniscript elements_miniscript::miniscript::decode::parse
 0.2%   0.7% 44.7KiB elements_miniscript elements_miniscript::miniscript::decode::parse
 0.2%   0.7% 44.7KiB elements_miniscript elements_miniscript::miniscript::decode::parse
 0.2%   0.7% 44.2KiB elements_miniscript elements_miniscript::miniscript::decode::parse
 0.2%   0.7% 43.2KiB elements_miniscript elements_miniscript::miniscript::decode::parse
 0.2%   0.7% 43.2KiB elements_miniscript elements_miniscript::miniscript::decode::parse
 0.2%   0.7% 42.7KiB elements_miniscript elements_miniscript::miniscript::decode::parse
 0.2%   0.5% 32.4KiB              wollet wollet::clients::BlockchainBackend::full_scan
 0.2%   0.5% 32.2KiB elements_miniscript elements_miniscript::descriptor::csfs_cov::cov::Le...
 0.1%   0.4% 22.9KiB            elements <elements::transaction::Transaction as elements::e...
29.8%  92.4%  5.8MiB                     And 11982 smaller methods. Use -n N to show more.
32.2% 100.0%  6.3MiB                     .text section size, the file size is 19.6MiB
@apoelstra
Copy link
Member

Thanks for the heads up. Let's investigate this. miniscript uses a comparable amount of generics and doesn't have nearly as much bloat.

@RCasatta
Copy link
Collaborator Author

Maybe related rust-bitcoin/rust-miniscript#585

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants