对 How to convert std::string_view to double? 的回答如下:
Apparently, many Boost functions use string streams internally, which has a lock on the global OS locale. So they have terrible multi-threaded performance
但是,我找不到有关此问题的任何其他内容。这是真的吗?
最佳答案
“字符串处理函数”过于笼统,因此具有误导性。
有一组有限的库可以进行区域感知转换。
在 IOStreams 方面只指定了一个(据我所知):Boost Lexical Cast .因此,它们将受语言环境的底层标准库实现的约束。他们可能会使用锁。
为了更完整:
newlocale()
, uselocale()
和 freelocale()
职能。 综上所述:
std::stoi
和 friend 或 c++17 from_chars
这实际上是有保证的成为金钱能买到的最好的表演关于c++ - Boost 字符串处理函数是否曾经持有全局锁?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63835752/