How efficient is std::string compared to null-terminated strings?

前端 未结 14 2154
心在旅途
心在旅途 2020-12-28 19:23

I\'ve discovered that std::strings are very slow compared to old-fashioned null-terminated strings, so much slow that they significantly slow down my overall pr

14条回答
  •  忘掉有多难
    2020-12-28 20:16

    The main rules of optimization:

    • Rule 1: Don't do it.
    • Rule 2: (For experts only) Don't do it yet.

    Are you sure that you have proven that it is really the STL that is slow, and not your algorithm?

提交回复
热议问题