This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

basic_string<> - useless because of its poor performance


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]