The benchmark

This section introduces a benchmark that measures performance of from_chars and to_chars against other conversion methods.

How does the benchmark work

  • Generates a vector of random integers of the size VECSIZE.
  • Each pair of conversion methods will transform the input vector of integers into a vector of strings and then back to another vector of integers. This round-trip will be verified so that the output vector is the same as the input vector.
  • The conversion is performed ITER times.
  • Errors from the conversion functions are not checked.
  • The code tests:
    • from_char/to​_chars
    • to_string/stoi
    • sprintf/atoi
    • ostringstream/istringstream

Code for from_chars/to_chars:

Get hands-on with 1200+ tech skills courses.