From 2417b775012d0aaa9ad9ec48a8c218a5882f6382 Mon Sep 17 00:00:00 2001 From: Simon Krueger Date: Mon, 19 Aug 2024 10:20:54 -0700 Subject: [PATCH] Add string to double parsing benchmarks Summary: This benchmarks various functions that convert decimal values in string representation to IEEE-754 double representation. These benchmarks `std::strtof`, `std::strtof` with a copy (needed for non-c-strings), `std::strtofl` with the C locale (for locale-indepent processing), `std::from_chars`, libdouble-conversion, and libfast_float. The functions are benchmarked on different inputs. There is input that is hardcoded values in decimal and exponentional notation. There is randomly generated values in the double space range. There is also inputs for single and double digit ints. As well as percentages. Note that `std::from_chars`, which on platform010/libstdc++ v11 uses `strtof` + `uselocale` [0]. libstdc++ v12 uses fast float[2]. 0: https://github.com/gcc-mirror/gcc/commit/932fbc868ad429167a3d4d5625aa9d6dc0b4506b 1: https://github.com/gcc-mirror/gcc/commit/490e23032baaece71f2ec09fa1805064b150fbc2#diff-d3c32d9c9c566f7f3888d150c6448428ea194170146a1a166917ba45b1252187 Reviewed By: yfeldblum, Orvid Differential Revision: D61356955 fbshipit-source-id: 6ec21b602b08505d946551dda49a35402bee7dae --- build/fbcode_builder/manifests/fast_float | 20 ++++++++++++++++++++ build/fbcode_builder/manifests/folly | 1 + 2 files changed, 21 insertions(+) create mode 100644 build/fbcode_builder/manifests/fast_float diff --git a/build/fbcode_builder/manifests/fast_float b/build/fbcode_builder/manifests/fast_float new file mode 100644 index 0000000..f91401d --- /dev/null +++ b/build/fbcode_builder/manifests/fast_float @@ -0,0 +1,20 @@ +[manifest] +name = fast_float + +[download] +url = https://github.com/fastfloat/fast_float/archive/refs/tags/v2.0.0.tar.gz +sha256 = 5d528ec20811577c5f2b2873528c085c500fdcd2b2c0901450509a71de5f1fa4 + +[build] +builder = cmake +subdir = fast_float-2.0.0 + +[cmake.defines] +FASTFLOAT_TEST = OFF +FASTFLOAT_SANITIZE = OFF + +[debs] +libfast-float-dev + +[rpms.distro=fedora] +fast_float-devel diff --git a/build/fbcode_builder/manifests/folly b/build/fbcode_builder/manifests/folly index 5fc5297..e8bc7d4 100644 --- a/build/fbcode_builder/manifests/folly +++ b/build/fbcode_builder/manifests/folly @@ -20,6 +20,7 @@ libdwarf libevent libsodium double-conversion +fast_float fmt lz4 snappy