Skip to content

Who drops all the Arcs ? #10065

Closed
Closed
@matklad

Description

@matklad

Running cargo llvm-lines --lib --release -p ide_ssr | head -n 24 gives extremely curious results:

 Lines          Copies        Function name
  -----          ------        -------------
  533069 (100%)  28309 (100%)  (TOTAL)
   20349 (3.8%)    357 (1.3%)  alloc::raw_vec::RawVec<T,A>::current_memory
   18324 (3.4%)    332 (1.2%)  <alloc::sync::Weak<T> as core::ops::drop::Drop>::drop
   14024 (2.6%)    332 (1.2%)  alloc::sync::Weak<T>::inner
   11718 (2.2%)    378 (1.3%)  core::ptr::metadata::from_raw_parts_mut
   10710 (2.0%)    357 (1.3%)  <alloc::raw_vec::RawVec<T,A> as core::ops::drop::Drop>::drop
    7984 (1.5%)    332 (1.2%)  <alloc::sync::Arc<T> as core::ops::drop::Drop>::drop
    7968 (1.5%)    332 (1.2%)  core::alloc::layout::Layout::for_value_raw
    6790 (1.3%)     97 (0.3%)  hashbrown::raw::RawTable<T,A>::drop_elements
    6596 (1.2%)     97 (0.3%)  <hashbrown::raw::RawIterRange<T> as core::iter::traits::iterator::Iterator>::next
    6240 (1.2%)     60 (0.2%)  salsa::blocking_future::Promise<T>::transition
    6100 (1.1%)     48 (0.2%)  core::iter::traits::iterator::Iterator::try_fold
    5454 (1.0%)     31 (0.1%)  hashbrown::raw::RawTable<T,A>::resize
    5029 (0.9%)    332 (1.2%)  alloc::sync::Arc<T>::drop_slow
    4624 (0.9%)     34 (0.1%)  alloc::raw_vec::RawVec<T,A>::grow_amortized
    4122 (0.8%)    458 (1.6%)  core::mem::align_of
    3890 (0.7%)    357 (1.3%)  <alloc::vec::Vec<T,A> as core::ops::drop::Drop>::drop
    3852 (0.7%)     37 (0.1%)  hashbrown::raw::RawTable<T,A>::find
    3668 (0.7%)     89 (0.3%)  <core::result::Result<T,E> as core::ops::try_trait::Try>::branch
    3415 (0.6%)     17 (0.1%)  hashbrown::raw::RawTable<T,A>::rehash_in_place
    3408 (0.6%)     24 (0.1%)  alloc::raw_vec::RawVec<T,A>::allocate_in
    3402 (0.6%)    378 (1.3%)  core::ptr::slice_from_raw_parts_mut

Seems like something causes us to generate more than three hundreds (!!!) instantiations of Arc::drop.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions