This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [Fwd: basic_string<> - useless because of its poor performance]
- To: Loren James Rittle <rittle at latour dot rsch dot comm dot mot dot com>
- Subject: Re: [Fwd: basic_string<> - useless because of its poor performance]
- From: Ryszard Kabatek <Ryszard dot Kabatek at softax dot pl>
- Date: Fri, 06 Jul 2001 08:38:34 +0200
- CC: libstdc++ at gcc dot gnu dot org
- References: <200107052215.f65MFXg63071@latour.rsch.comm.mot.com>
- Reply-To: Ryszard dot Kabatek at softax dot pl
The current implementation of basic_string is to slow to be useful.
BTW. I implemented the current version of _M_mutate and some other
string modification member functions :-)
I can only recommend again to implement a funcntion, like the one below
size_type
get_new_capacity(size_type n,
size_type max_len)
{
if (n > max_len) // OK, we get an exception in _Rep::_S_create
return n;
size_type result = n < 17 ? 32 : 2*n;
return result < max_len ? result : max_len; // Avoiding an exception in _Rep::_S_create
}
that will be called in _M_mutate and perhaps in other places (not in reserve).
I can prepare a patch if you like.
Regards
--
Ryszard Kabatek