Skip to content

Avoid copy constructing BichselData

Avoid copy constructing BichselData

In OverlayTest.py with 100 events

  1742 8470716 calls to allocation functions with 355.31K peak consumption from        
  1743 __gnu_cxx::new_allocator<>::allocate(unsigned long, void const*)                
  1744   at /cvmfs/sft.cern.ch/lcg/releases/gcc/11.2.0-8a51a/x86_64-centos7/include/c++/11.2.0/ext/new_allocator.h:127
  1745   in /cvmfs/atlas-nightlies.cern.ch/repo/sw/23.0_Athena_x86_64-centos7-gcc11-opt/2023-04-24T2101/Athena/23.0.25/InstallArea/x86_64-centos7-gcc11-opt/lib/libxAODCore.so
  1746 std::allocator_traits<>::allocate(std::allocator<>&, unsigned long)             
  1747   at /cvmfs/sft.cern.ch/lcg/releases/gcc/11.2.0-8a51a/x86_64-centos7/include/c++/11.2.0/bits/alloc_traits.h:460
  1748 std::_Vector_base<>::_M_allocate(unsigned long)                                 
  1749   at /cvmfs/sft.cern.ch/lcg/releases/gcc/11.2.0-8a51a/x86_64-centos7/include/c++/11.2.0/bits/stl_vector.h:346
  1750 std::_Vector_base<>::_M_create_storage(unsigned long)                           
  1751   at /cvmfs/sft.cern.ch/lcg/releases/gcc/11.2.0-8a51a/x86_64-centos7/include/c++/11.2.0/bits/stl_vector.h:361
  1752 std::_Vector_base<>::_Vector_base(unsigned long, std::allocator<> const&)       
  1753   at /cvmfs/sft.cern.ch/lcg/releases/gcc/11.2.0-8a51a/x86_64-centos7/include/c++/11.2.0/bits/stl_vector.h:305
  1754 std::vector<>::vector(std::vector<> const&)                                     
  1755   at /cvmfs/sft.cern.ch/lcg/releases/gcc/11.2.0-8a51a/x86_64-centos7/include/c++/11.2.0/bits/stl_vector.h:555
  1756 void std::_Construct<>(std::vector<>*, std::vector<> const&)                    
  1757   at /cvmfs/sft.cern.ch/lcg/releases/gcc/11.2.0-8a51a/x86_64-centos7/include/c++/11.2.0/bits/stl_construct.h:109
  1758 std::vector<>* std::__uninitialized_copy<>::__uninit_copy<>(__gnu_cxx::__normal_iterator<>, __gnu_cxx::__normal_iterator<>, std::vector<>*)
  1759   at /cvmfs/sft.cern.ch/lcg/releases/gcc/11.2.0-8a51a/x86_64-centos7/include/c++/11.2.0/bits/stl_uninitialized.h:92
  1760 std::vector<>* std::uninitialized_copy<>(__gnu_cxx::__normal_iterator<>, __gnu_cxx::__normal_iterator<>, std::vector<>*)
  1761   at /cvmfs/sft.cern.ch/lcg/releases/gcc/11.2.0-8a51a/x86_64-centos7/include/c++/11.2.0/bits/stl_uninitialized.h:151
  1762 std::vector<>* std::__uninitialized_copy_a<>(__gnu_cxx::__normal_iterator<>, __gnu_cxx::__normal_iterator<>, std::vector<>*, std::allocator<>&)
  1763   at /cvmfs/sft.cern.ch/lcg/releases/gcc/11.2.0-8a51a/x86_64-centos7/include/c++/11.2.0/bits/stl_uninitialized.h:333
  1764 std::vector<>::vector(std::vector<> const&)                                     
  1765   at /cvmfs/sft.cern.ch/lcg/releases/gcc/11.2.0-8a51a/x86_64-centos7/include/c++/11.2.0/bits/stl_vector.h:558
  1766 4235071 calls with 0B peak consumption from:                                    
  1767     BichselData::BichselData(BichselData const&)                                
  1768       at /build/atnight/localbuilds/nightlies/Athena/23.0/athena/InnerDetector/InDetDigitization/PixelDigitization/src/BichselData.h:14
  1769       in /cvmfs/atlas-nightlies.cern.ch/repo/sw/23.0_Athena_x86_64-centos7-gcc11-opt/2023-04-24T2101/Athena/23.0.25/InstallArea/x86_64-centos7-gcc11-opt/lib/libPixelDigitization.so
  1770     EnergyDepositionTool::BichselSim(double, int, double, double, CLHEP::HepRandomEngine*) const
  1771       at /build/atnight/localbuilds/nightlies/Athena/23.0/athena/InnerDetector/InDetDigitization/PixelDigitization/src/EnergyDepositionTool.cxx:334

ping @jchapman and @tadej

Not sure how much this will help but prb better not to allocate and copy , just take a const ref

Edited by Christos Anastopoulos

Merge request reports