Seeking Endorsement for Charconv
Hello, At the beginning of the summer I solicited feedback for an in-progress C++11 implementation of <charconv> for a proposal to Boost. The library is now complete with that feedback incorporated, and I am seeking endorsement. Should the library receive endorsement Chris Kormanyos has volunteered to serve as the review manager. What is Charconv? It is a character conversion library that converts a character sequence into a number (from_chars) or converts a number into a character sequence (to_chars). This is similar to strtod and printf with two key differences. First and most important is a roundtrip guarantee. That is a number converted into a character sequence, and then back into a number will be identical to the starting value. Second, you can easily specify an input/output format with a chars_format argument, and also provide a target precision. Lastly, instead of requiring recent compilers (e.g. GCC 11, and MSVC 19.24) and C++17 to get full support for <charconv> you can have it now with GCC 5, Clang 3.7, or MSVC 19.00 and C++11. What types are supported? All builtin integers plus __int128 and unsigned __int128. For floating point types all built-in IEEE 754 compliant types to include those provided in C++23’s <stdfloat>, and __float128. A notable example of a non-IEEE 754 compliant built-in type is ibm128 provided on older versions of PowerPC. How do I use the library? The repo can be found here: https://github.com/cppalliance/charconv. Since this is a compiled library, directions for use with b2, vcpkg, and conan are provided. What is the performance like? I added a table of benchmarks (https://master.charconv.cpp.al/#ref_benchmarks) that compares this implementation to the performance of: STL (printf, strtoX, and <charconv>), Boost.Lexical_Cast, Boost.Spirit, and libdouble-conversion. In summary we meet or exceed the performance of GCC and MSVC <charconv>, and exceed by up to several multiples the performance of all the other libraries. Thanks to Stephan T. Lavavej for providing his benchmarking file in the original discussion. Why is this not going into Boost.Compat? The size of this library exceeds the scope of Boost.Compat. Compat is designed for headers that can be implemented in a small amount of code. <latch> with implementation, testing and documentation was ~350 LOC while Charconv is ~29,500. Please let me know if you have any questions or issues with the library. Thanks, Matt Borland —- C++ Alliance Staff Engineer
On Thu, Sep 21, 2023 at 10:26 AM Matt Borland via Boost < boost@lists.boost.org> wrote:
I added a table of benchmarks ( https://master.charconv.cpp.al/#ref_benchmarks)
[...] In summary we meet or exceed the performance of GCC and MSVC
<charconv>,
Looking good! Maybe on the to_chars() side, you could add std::to_string (C++11), and format/print from FMT lib (C++11 or not less) / std (C++20), to compare against. --DD
On Thu, Sep 21, 2023 at 4:25 AM Matt Borland wrote:
At the beginning of the summer I solicited feedback for an in-progress C++11 implementation of <charconv> for a proposal to Boost. The library is now complete with that feedback incorporated, and I am seeking endorsement. Should the library receive endorsement Chris Kormanyos has volunteered to serve as the review manager.
I endorse it. Aside from users, other Boost libraries are also interested in using it. Glen
On Thu, 21 Sept 2023 at 10:26, Matt Borland via Boost
Hello,
At the beginning of the summer I solicited feedback for an in-progress C++11 implementation of <charconv> for a proposal to Boost. The library is now complete with that feedback incorporated, and I am seeking endorsement. Should the library receive endorsement Chris Kormanyos has volunteered to serve as the review manager.
I endorse this. I plan on using it to parse MySQL values when using the text protocol. Regards, Ruben.
On Thu, Sep 21, 2023 at 1:26 AM Matt Borland via Boost
...
I endorse this, as it is a perfect fit for Boost: this library is a straight port of new C++ standard library components to older C++ versions. However, full disclosure is needed: both Matt Borland and Ruben Perez are part of The C++ Alliance staff, as well as myself. Thanks
participants (5)
-
Dominique Devienne
-
Glen Fernandes
-
Matt Borland
-
Ruben Perez
-
Vinnie Falco