Skip to content

Commit

Permalink
Add string to double parsing benchmarks
Browse files Browse the repository at this point in the history
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: gcc-mirror/gcc@932fbc8
1:  gcc-mirror/gcc@490e230#diff-d3c32d9c9c566f7f3888d150c6448428ea194170146a1a166917ba45b1252187

Reviewed By: yfeldblum, Orvid

Differential Revision: D61356955

fbshipit-source-id: 6ec21b602b08505d946551dda49a35402bee7dae
  • Loading branch information
skrueger authored and facebook-github-bot committed Aug 19, 2024
1 parent a110469 commit bdae91a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions build/fbcode_builder/manifests/fast_float
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions build/fbcode_builder/manifests/folly
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ libdwarf
libevent
libsodium
double-conversion
fast_float
fmt
lz4
snappy
Expand Down

0 comments on commit bdae91a

Please sign in to comment.