Re: optimize basic_string

2024-11-27 Thread Jonathan Wakely
On Tue, 26 Nov 2024 at 15:43, Jan Hubicka wrote: > > Hi, > here is updated patch. > > I am not ceratin if: > const size_t __diffmax > = __gnu_cxx::__numeric_traits::__max / sizeof(_CharT); > really needs "/ sizeof (_CharT)". I think we only need to be able to > compute the diffe

Re: optimize basic_string

2024-11-26 Thread Jan Hubicka
Hi, here is updated patch. I am not ceratin if: const size_t __diffmax = __gnu_cxx::__numeric_traits::__max / sizeof(_CharT); really needs "/ sizeof (_CharT)". I think we only need to be able to compute the difference between two entries in multiplies of sizeof(_CharT)? However

Re: optimize basic_string

2024-11-26 Thread Jonathan Wakely
On Tue, 26 Nov 2024 at 12:22, Jan Hubicka wrote: > > > On 24/11/24 01:42 +0100, Jan Hubicka wrote: > > > Hi, > > > another common source of unnecesary throw_bad_alloc calls is > > > basic_string::_M_create. > > >basic_string<_CharT, _Traits, _Alloc>:: > > >_M_create(size_type& __capacity,

Re: optimize basic_string

2024-11-26 Thread Jan Hubicka
> On 24/11/24 01:42 +0100, Jan Hubicka wrote: > > Hi, > > another common source of unnecesary throw_bad_alloc calls is > > basic_string::_M_create. > >basic_string<_CharT, _Traits, _Alloc>:: > >_M_create(size_type& __capacity, size_type __old_capacity) > >{ > > // _GLIBCXX_RESOLVE

Re: optimize basic_string

2024-11-25 Thread Jonathan Wakely
On 24/11/24 01:42 +0100, Jan Hubicka wrote: Hi, another common source of unnecesary throw_bad_alloc calls is basic_string::_M_create. basic_string<_CharT, _Traits, _Alloc>:: _M_create(size_type& __capacity, size_type __old_capacity) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 83. St

Re: optimize basic_string

2024-11-25 Thread Jonathan Wakely
Hi Honza, please CC the libstdc++ list on patches, thanks. On Sun, 24 Nov 2024 at 00:43, Jan Hubicka wrote: > > Hi, > another common source of unnecesary throw_bad_alloc calls is > basic_string::_M_create. > basic_string<_CharT, _Traits, _Alloc>:: > _M_create(size_type& __capacity, size_