Speeding up v3 basic_string
Paolo Carlini
pcarlini@unitus.it
Wed Dec 12 08:25:00 GMT 2001
Nathan Myers wrote:
[snip]
> Keep in mind that malloc is often the most expensive operation, by far,
> and it's worth doing a lot of checking to avoid doing it. If the result
> string will be equal to or shorter than the the original destination,
> and is not already shared, we can (and should) work in place, using
> memmove for some ranges.
Once more, thanks for your detailed explanations, I will try to use them to my
best in the next weeks.
Now that Vladimir's problem seems really a false alarm :-), I would like to
proceed with a further small, safe in my opinion, step. I will post a patch
soon.
It is about a few basic_string member functions which have const char* as the
source of the copy. In such cases, I believe, _M_replace_safe could be safely
used, with minor modifications, more or less as happens for the various append.
Cheers,
Paolo.
More information about the Libstdc++
mailing list