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]
Other format: [Raw text]

Re: [PATCH] Basic_string::insert


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.



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