I\'ve discovered that std::string
s are very slow compared to old-fashioned null-terminated strings, so much slow that they significantly slow down my overall pr
std::string
will always be slower than C-strings. C-strings are simply a linear array of memory. You cannot get any more efficient than that, simply as a data structure. The algorithms you use (like strcat()
or strcpy()
) are generally equivalent to the STL counterparts. The class instantiation and method calls will be, in relative terms, significantly slower than C-string operations (even worse if the implementation uses virtuals). The only way you could get equivalent performance is if the compiler does optimization.