From 90dbcf1b010d7cdee475428e38fe30f556fc7ba5 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 4 Aug 2023 15:01:35 -0400 Subject: [PATCH] Add benchmark tables --- doc/charconv.adoc | 1 + doc/charconv/benchmarks.adoc | 44 ++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 doc/charconv/benchmarks.adoc diff --git a/doc/charconv.adoc b/doc/charconv.adoc index d869dbb..e4e049e 100644 --- a/doc/charconv.adoc +++ b/doc/charconv.adoc @@ -21,6 +21,7 @@ include::charconv/chars_format.adoc[] include::charconv/from_chars.adoc[] include::charconv/to_chars.adoc[] include::charconv/reference.adoc[] +include::charconv/benchmarks.adoc[] include::charconv/sources.adoc[] include::charconv/copyright.adoc[] diff --git a/doc/charconv/benchmarks.adoc b/doc/charconv/benchmarks.adoc new file mode 100644 index 0000000..9e325d6 --- /dev/null +++ b/doc/charconv/benchmarks.adoc @@ -0,0 +1,44 @@ +//// +Copyright 2023 Matt Borland +Distributed under the Boost Software License, Version 1.0. +https://www.boost.org/LICENSE_1_0.txt +//// + += benchmarks +:idprefix: benchmarks + +The benchmarks below were run on x86_64 using GCC 13.1 with libstdc++. +The values are relative to the performance of `std::printf` and `std::stroto(f/d)`. +Larger numbers are more performant (e.g. 2.00 means twice as fast). + +.to_chars shortest representation +|=== +|Function|Relative Performance (float / double) + +|std::printf +|1.00 / 1.00 +|Boost.lexical_cast +|0.55 / 0.46 +|Boost.spirit.karma +|1.81 / 2.61 +|std::to_chars +|3.58 / 4.86 +|Boost.Charconv.to_chars +|3.64 / 4.89 +|=== + +.from_chars with scientific formatting +|=== +|Function|Relative Performance (float / double) + +|std::strto(f/d) +|1.00 / 1.00 +|Boost.lexical_cast +|0.00 / 0.00 +|Boost.spirit.qi +|2.58 / 3.33 +|std::from_chars +|3.18 / 5.80 +|Boost.Charconv.from_chars +|3.26 / 5.80 +|===