I have a large workspace with a 'root crate'. The 'root crate' is < 1000 lines and takes 3+s to build. This is not a big deal, but I'm curious where the time is going to.
I run cargo llvm-lines
, and I get back:
Lines Copies Function name
----- ------ -------------
56667 (100%) 1997 (100%) (TOTAL)
12999 (22.9%) 61 (3.1%) <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop
1791 (3.2%) 26 (1.3%) alloc::rc::Rc<T>::new
1749 (3.1%) 34 (1.7%) alloc::rc::RcInnerPtr::inc_strong
1221 (2.2%) 12 (0.6%) <alloc::boxed::Box<T,A> as core::ops::drop::Drop>::drop
1038 (1.8%) 84 (4.2%) alloc::rc::RcInnerPtr::strong
955 (1.7%) 54 (2.7%) alloc::boxed::Box<T>::new
780 (1.4%) 34 (1.7%) <alloc::rc::Rc<T> as core::clone::Clone>::clone
776 (1.4%) 13 (0.7%) dominator::utils::EventListener::new
762 (1.3%) 61 (3.1%) alloc::rc::RcInnerPtr::weak
630 (1.1%) 6 (0.3%) alloc::raw_vec::RawVec<T,A>::current_memory
629 (1.1%) 6 (0.3%) <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::next
585 (1.0%) 5 (0.3%) <futures_util::stream::stream::for_each::ForEach<St,Fut,F> as core::future::future::Future>::poll
Am I reading this right? Something like 30% of the time llvm spends on compiling the root crate is going to ... instantiating Rc<T>
's ?