basic_string<> - useless because of its poor performance
Ryszard Kabatek
Ryszard.Kabatek@softax.pl
Mon Jul 2 01:44:00 GMT 2001
I compiled a text parsing program with gcc 3.0 on linux.
The executable works much much slower (by factor 10! copmared to gcc 2.9x) now.
In my program there are a lot of calls of string::push_back and string::append.
As far as I see basic_string reallocates the storage everey time
the push_back/append member fuction is called!
I my opinion we need a function, for example called get_new_capacity,
to expand the necessary storage, that will be called in replace, _M_mutate and so far.
size_type get_new_capacity(size_type n) {return n < 17 ? 32 : 2*n;}
Currtently basic_string is useless.
--
Ryszard Kabatek
More information about the Libstdc++
mailing list