Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSVC performance compared to std::to_string? #986

Closed
emmenlau opened this issue Dec 17, 2018 · 1 comment
Closed

MSVC performance compared to std::to_string? #986

emmenlau opened this issue Dec 17, 2018 · 1 comment

Comments

@emmenlau
Copy link

I'm completely new to numeric-string-conversion, so please forgive if my question is naiive.

I implemented a replacement for std::to_string(vNumber) using std::string(fmt::format("{}", vNumber)) to convert floating point values (double and float) to std::string. On Linux (gcc-6, gcc-7) and MacOSX 10.11 (Apple clang) I get twice the performance of std::to_string() for double! But on MSVC 2015 and 2017, the performance is typically slightly worse than std::to_string(), typically ~120% of the execution time.

I'm confused if this is to be expected? I've seen the nice work in #147 but I'm not knowledgabe enough to understand if I need to wait for this or if already now the performance could be better.

@vitaut
Copy link
Contributor

vitaut commented Dec 19, 2018

{fmt} relies on snprintf for floating-point formatting right now, so it all depends how snprintf and to_string are implemented. On MSVC snprintf is known to be of a very poor quality. This will be addressed by #147 once the new floating-point formatter which is mostly complete is fully tested and enabled.

@vitaut vitaut closed this as completed Dec 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants