2 ms·
to_string is just a wrapper around sprintf... here's the (de-__uglyfied) code on libstdc++: inline string to_string(float val) { const int n
by jcelerier 5y ago
to_string is just a wrapper around sprintf... here's the (de-__uglyfied) code on libstdc++:
inline string
to_string(float val)
{
const int n = gnu_cxx::numeric_traits<float>::max_exponent10 + 20;
return gnu_cxx::to_xstring<string>(&std::vsnprintf, n, "%f", val);
}
it will be worse in pretty much every metric than fmt::format("{}", val);