Proposal to speedup to_string / to_wstring for floating points numbers by reducing sprintf calls and allocations using stack buffer.
Benchmark results:
http://quick-bench.com/vS-2RuYzsZrBNRbhsliN4o8M8B4
- to_string is improved in 1.3x times for small values (tested on zero)
- to_wstring is not changed for small values
- to_string is improved in 2.1x times for -DBL_MAX
- to_wstring is improved in 5.2x times for -DBL_MAX
Proposed implementation fallbacks to the previous one for some long double values and non-standard floats / doubles so conversion tests were added for numeric_limits<T>::max / min / lowest.