Re: Optimization for std::to_string()

2018-07-20 Thread Jonathan Wakely
On 20/07/18 13:51 +0300, niXman wrote: Jonathan Wakely 2018-07-20 13:05: On 20/07/18 12:44 +0300, niXman wrote: Thanks. How did you verify it's an optimization? Optimization is that there is no superfluous copying into string. The to_string functions always pass at least __n=16 to

Re: Optimization for std::to_string()

2018-07-20 Thread niXman
Jonathan Wakely 2018-07-20 13:05: On 20/07/18 12:44 +0300, niXman wrote: Thanks. How did you verify it's an optimization? Optimization is that there is no superfluous copying into string. The to_string functions always pass at least __n=16 to __to_xstring, which is larger than the SSO

Re: Optimization for std::to_string()

2018-07-20 Thread Jonathan Wakely
On 20/07/18 12:44 +0300, niXman wrote: Hi, Patch in attachments. Thanks. How did you verify it's an optimization? The to_string functions always pass at least __n=16 to __to_xstring, which is larger than the SSO buffer in std::__cxx11::string, and so forces a memory allocation. The

Optimization for std::to_string()

2018-07-20 Thread niXman
Hi, Patch in attachments. Tested on x86_64-linux-gnu. -- Regards, niXman ___ C++ for Bitcoins: github.com/niXman Index: libstdc++-v3/include/ext/string_conversions.h === ---