Better suggestion is to develop with std::string initially, then
optimise where necessary. (Rational Quantify is a great tool!)
I'm tempted to say: that has nothing to do with std::string. In
general, write clean, understandable code, with rigorous
encapsulation. Then, if it's not fast enough, use the profiler
to see where the problem is, and correct only that.
Note that the most important single aspect for performance
critical code is encapsulation. Because without good
encapsultation, trying to change anything, once you've found the
problem, can be hell.
On one project by switching to stack based 'C' strings in some
inner loops I managed to knock 50% off the application
startup.
Possibly changing to a different std::string implementation
could have had a similar effect; a lot depends on what you are
doing. Or, if you have a fixed upper limit to the length you
need, create your own fixed length strings. (A lot of
applications, like those I currently work on, write their data
to a data base. If the field in the data base is varchar(20),
then a fixed length string of length 20 is more appropriate than
std::string. And in fact, our current implementation does use
FixedString... a template on the actual length.)
Another thing to do is reserve() at least a good apromixation of the
final string. Biggest speed difference with C/vs std::string is down
to the memory allocation / free-ing.
Again, it depends. If most of youre strings are short, and the
implementation you are using uses the small string optimization,
you may never have a dynamic allocation/free. Typically, I
suspect that you're right in a lot of cases. But I wouldn't
assume so until I'd actually profiled it.