This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
basic_string<> - useless because of its poor performance
- To: libstdc++ at gcc dot gnu dot org
- Subject: basic_string<> - useless because of its poor performance
- From: Ryszard Kabatek <Ryszard dot Kabatek at softax dot pl>
- Date: Mon, 02 Jul 2001 10:44:49 +0200
- Reply-To: Ryszard dot Kabatek at softax dot pl
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