[PATCH] Basic_string::insert
Paolo Carlini
pcarlini@unitus.it
Wed Dec 19 02:57:00 GMT 2001
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.
More information about the Libstdc++
mailing list