4 ms·
"faster than strtod" is hardly even worth mentioning. As the paper points out, if that's what you wanted there were already several libraries far faster than th
by jeffbee 6y ago
"faster than strtod" is hardly even worth mentioning. As the paper points out, if that's what you wanted there were already several libraries far faster than that. What's cool is it's also much faster than absl::from_chars, which had been the fastest thing around.
- nly 6y agoThe implementation buried inside RapidJSON[0] is also very fast. Pretty much any library for protocols that encode floats to decimal strings needs such an implementation to be performance competitive. Interestingly RapidJSON is one of the few JSON libraries for C++ that has a "full precision" mode. Most don't even do str->double conversions precisely. [0] https://github.com/Tencent/rapidjson/blob/master/include/rapidjson/internal/strtod.h https://github.com/Tencent/rapidjson/blob/master/include/rap...
- ape4 6y agoWhy is strtod so slow. Lots of special cases? Or hard to change since hidden away.
- jeffbee 6y agostrtod handles decimal and hexadecimal strings, trailing junk, whatever else the locale allows, etc. It's pretty branchy when you think about it.