Why is splitting a string slower in C++ than Python?

后端 未结 8 1674
感情败类
感情败类 2020-12-07 08:14

I\'m trying to convert some code from Python to C++ in an effort to gain a little bit of speed and sharpen my rusty C++ skills. Yesterday I was shocked when a naive impleme

8条回答
  •  有刺的猬
    2020-12-07 08:58

    You're making the mistaken assumption that your chosen C++ implementation is necessarily faster than Python's. String handling in Python is highly optimized. See this question for more: Why do std::string operations perform poorly?

提交回复
热议问题