viruta.org - Federico's Blog

Example domain paragraphs

Someone mentioned cargo-bloat the other day and it reminded me that I have been wanting to measure the code size for generic functions in librsvg, and see if there are improvements to be made.

Cargo-bloat can give you a rough estimate of the code size for each Rust crate in a compiled binary, and also a more detailed view of the amount of code generated for individual functions. It needs a [bin] target to work on; if you have just a [lib] , it will not do anything. So, for librsvg's purposes, I ran cargo-bloat on the rsvg-convert binary.

$ cargo bloat -- release -- crates Finished release [ optimized ] target ( s ) in 0.23 s Analyzing target / release / rsvg - bench File . text Size Crate 10.0 % 38.7 % 1.0 MiB librsvg 4.8 % 18.8 % 505.5 KiB std 2.5 % 9.8 % 262.8 KiB clap 1.8 % 7.1 % 191.3 KiB regex ... lines omitted ... 25.8 % 100.0 % 2.6 MiB . text section size , the file size is 10.2 MiB Note : numbers above are a result of guesswork . They are not 100 % correct and never will be . The output above is for cargo bloat --release --crates .

Links to viruta.org (3)