This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] Basic_string::insert
- From: Paolo Carlini <pcarlini at unitus dot it>
- To: libstdc++ at gcc dot gnu dot org
- Cc: Paolo Carlini <pcarlini at unitus dot it>, ncm at cantrip dot org
- Date: Wed, 19 Dec 2001 11:55:35 +0100
- Subject: Re: [PATCH] Basic_string::insert
- References: <3C1FAAF5.B71A5CBC@unitus.it>
Unpolitely replying to myself to point out that...
> This is a particularly favourable example (in-place):
>
> #include <string>
> int main()
> {
> std::string str = "a";
>
> for (int i = 0; i < 20000000; i++)
> str.insert(str.size() / 3, str.c_str(), str.size() / 3);
> }
... this is of course not only particularly "favourable" but also particularly
"stupid" :-).I should have pointed out this more clearly. It is just a (favourable,
indeed) snippet demonstrating that when *no* chars are really inserted, the newest
part of the code, the "in-place" part, has a -low- overhead if compared with the
general code currently present in the mainline.
Anyway, more benchmarks to come...
Paolo.