Count the number of lines of LLVM IR across all instantiations of a generic function. Based on a suggestion from @eddyb on how to count monomorphized functions in order to debug compiler memory usage, executable size and compile time.
\
unoptimized LLVM IR
\first used grep '^define' to get only the lines defining function bodies
\then regex replace in my editor to remove everything before @ and everything after (
\then sort | uniq -c
Install with cargo install cargo-llvm-lines
.
One line per function with three columns of output:
``` $ cargo llvm-lines | head -20
Lines Copies Function name
----- ------ -------------
30737 (100%) 1107 (100%) (TOTAL)
1395 (4.5%) 83 (7.5%) core::ptr::dropinplace
760 (2.5%) 2 (0.2%) alloc::slice::mergesort
734 (2.4%) 2 (0.2%) alloc::rawvec::RawVec
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.