Bug 118130 (std::vector) - std::vector code quality issues
Summary: std::vector code quality issues
Status: NEW
Alias: std::vector
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 15.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: meta-bug, missed-optimization
Depends on: 26388 58483 60621 80641 80813 85929 86276 87106 90345 93891 108487 109353 109440 109442 109443 109849 110378 110909 113835 116813 117541 117638 117639 117924 117957 118167 77689 90436 109205
Blocks:
  Show dependency treegraph
 
Reported: 2024-12-19 15:44 UTC by Jan Hubicka
Modified: 2024-12-28 14:41 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2024-12-21 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Hubicka 2024-12-19 15:44:47 UTC
meta-bug for code quality problems of std::vector.

I made statistic of use of std::vector in clang binary counting number of occurrences of abstract instances of these functions in debug info. This is not very precise, since it counts number of source files needing those functions, not number of calls, but gives a rough idea how std::vector is used.

 
    261  std::vector<...>::vector<...>(...)
    837  std::vector<...>::_M_realloc_append<...>(...)::_Guard::~_Guard(...)
   2298  std::vector<...>::~vector(...)
   2382  std::vector<...> clang::ast_matchers::internal::VariadicOperatorMatcher<...>::getMatchers<...>(...) const &
   2682  std::vector<...>::vector(...)
   3357  std::vector<...>::at(...)
   3357  std::vector<...>::at(...) const
   3357  std::vector<...>::back(...) const
   3357  std::vector<...>::capacity(...) const
   3357  std::vector<...>::cbegin(...) const
   3357  std::vector<...>::cend(...) const
   3357  std::vector<...>::crbegin(...) const
   3357  std::vector<...>::crend(...) const
   3357  std::vector<...>::data(...)
   3357  std::vector<...>::front(...) const
   3357  std::vector<...>::max_size(...) const
   3357  std::vector<...>::_M_emplace_aux(...)
   3357  std::vector<...>::_M_fill_assign(...)
   3357  std::vector<...>::_M_fill_initialize(...)
   3357  std::vector<...>::_M_fill_insert(...)
   3357  std::vector<...>::_M_insert_rval(...)
   3357  std::vector<...>::_M_range_check(...) const
   3357  std::vector<...>::_M_shrink_to_fit(...)
   3357  std::vector<...>::rbegin(...)
   3357  std::vector<...>::rbegin(...) const
   3357  std::vector<...>::rend(...)
   3357  std::vector<...>::rend(...) const
  3357  std::vector<...>::shrink_to_fit(...)
   3357  std::vector<...>::_S_max_size(...)
   3357  std::vector<...>::_S_use_relocate(...)
   3357  std::vector<...>::swap(...)
   3360  std::vector<...>::front(...)
   3360  std::vector<...>::pop_back(...)
   3360  std::vector<...>::reserve(...)
   3363  std::vector<...>::_M_default_initialize(...)
   3366  std::vector<...>::_S_check_init_len(...)
   3369  std::vector<...>::_M_default_append(...)
   3375  std::vector<...>::operator[](...) const
   3381  std::vector<...>::operator[](...)
   3384  std::vector<...>::back(...)
   3384  std::vector<...>::clear(...)
   3390  std::vector<...>::_M_erase_at_end(...)
   3408  std::vector<...>::_M_check_len(...) const
   3408  std::vector<...>::_S_relocate(...)
   3420  std::vector<...>::empty(...) const
   3453  std::vector<...>::begin(...)
   3474  std::vector<...>::end(...)
   3504  std::vector<...>::end(...) const
   3525  std::vector<...>::begin(...) const
   3534  std::vector<...>::data(...) const
   3606  std::vector<...>::size(...) const
   6714  std::vector<...>::assign(...)
   6714  std::vector<...>::_M_move_assign(...)
   6714  std::vector<...>::_S_do_relocate(...)
   6714  std::vector<...>::_S_nothrow_relocate(...)
   6723  std::vector<...>::resize(...)
   6726  std::vector<...>::erase(...)
   6726  std::vector<...>::_M_erase(...)
   6741  std::vector<...>::push_back(...)
  10071  std::vector<...>::operator=(...)
  13428  std::vector<...>::insert(...)

I am bit surprised insert beating push_back, but overall it seems to make sense.
Same stats for webkit

     54  std::vector<...>::_M_realloc_insert<...>(...)::_Guard::_Guard(...)
     54  std::vector<...>::_M_realloc_insert<...>(...)::_Guard::~_Guard(...)
     54  std::vector<...>::_Temporary_value::_Storage::_Storage(...)
     54  std::vector<...>::_Temporary_value::_Storage::~_Storage(...)
     54  std::vector<...>::_Temporary_value::_Temporary_value<...>(...)
     54  std::vector<...>::_Temporary_value::~_Temporary_value(...)
     66  std::vector<...>::pop_back(...)
     72  std::vector<...>::operator=(...)
     75  std::vector<...>::cbegin(...) const
     78  std::vector<...>::data(...)
     87  std::vector<...>::reserve(...)
     87  std::vector<...>::_S_check_init_len(...)
    114  std::vector<...>::_M_default_append(...)::_Guard_elts::_Guard_elts(...)
    114  std::vector<...>::_M_default_append(...)::_Guard_elts::~_Guard_elts(...)
    120  std::vector<...>::capacity(...) const
    144  std::vector<...>::_M_default_append(...)
    147  std::vector<...>::empty(...) const
    150  std::vector<...>::resize(...)
    159  std::vector<...>::clear(...)
    231  std::vector<...>::operator[](...) const
    240  std::vector<...>::begin(...) const
    243  std::vector<...>::end(...) const
    246  std::vector<...>::_M_erase_at_end(...)
    279  std::vector<...>::operator[](...)
    294  std::vector<...>::back(...)
    294  std::vector<...>::_M_default_append(...)::_Guard::_Guard(...)
    294  std::vector<...>::_M_default_append(...)::_Guard::~_Guard(...)
    297  std::vector<...>::_S_relocate(...)
    327  std::vector<...>::push_back(...)
    354  std::vector<...>::_M_realloc_append<...>(...)::_Guard_elts::_Guard_elts(...)
    354  std::vector<...>::_M_realloc_append<...>(...)::_Guard_elts::~_Guard_elts(...)
    426  std::vector<...>::begin(...)
    432  std::vector<...>::end(...)
    453  std::vector<...>::_M_check_len(...) const
    528  std::vector<...>::size(...) const
   1104  std::vector<...>::_M_realloc_append<...>(...)::_Guard::_Guard(...)
   1104  std::vector<...>::_M_realloc_append<...>(...)::_Guard::~_Guard(...)
   1104  std::vector<...>::~vector(...)
   1296  std::vector<...>::vector(...)
Comment 1 Andrew Pinski 2024-12-21 07:13:05 UTC
.