utf8 <-> utf16: codecvt poor performance

后端 未结 2 1873
自闭症患者
自闭症患者 2021-02-20 01:16

I\'m looking onto some of my old (and exclusively win32 oriented) stuff and thinking about making it more modern/portable - i.e. reimplementing some widely reusable parts in C++

2条回答
  •  面向向阳花
    2021-02-20 01:49

    In my own testing, I found that the constructor call for wstring_convert has a massive overhead, at least on Windows. As other answers suggest, you'll probably struggle to beat the native Windows implementation, but try modifying your code to construct the converter outside of the loop. I expect you'll see an improvement of between 5x and 20x, particularly in a debug build.

提交回复
热议问题