-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fast_float impl for string-to-float conversion in folly
Summary: Adds implementations of `folly::detail::str_to_floating` that uses `fast_float::from_chars`, which is expected to be ~2-4x as fast as libdouble-conversion [0][1]. The version of `folly::detail::str_to_floating` that uses libdouble-conversion remains the same. This implementation can be replaced with `std::from_chars` on libstdc++ version 12 and greater which also uses fast_float [3]. This implementation is enabled with a buck config switch, so clients can opt in. 0: https://master.charconv.cpp.al/#benchmark_results_ 1: https://github.com/boostorg/charconv/blob/develop/benchmark/from_chars_floating.cpp 3: gcc-mirror/gcc@490e230#diff-d3c32d9c9c566f7f3888d150c6448428ea194170146a1a166917ba45b1252187 Reviewed By: yfeldblum Differential Revision: D60997956 fbshipit-source-id: f62edefdde80aa76c409cb7b9d0078932cfce7e0
- Loading branch information
1 parent
784fb14
commit 10b1f27
Showing
7 changed files
with
269 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# | ||
# - Try to find fast_float library | ||
# This will define | ||
# FASTFLOAT_FOUND | ||
# FASTFLOAT_INCLUDE_DIR | ||
# | ||
|
||
find_path(FASTFLOAT_INCLUDE_DIR NAMES fast_float/fast_float.h) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
FIND_PACKAGE_HANDLE_STANDARD_ARGS( | ||
FastFloat DEFAULT_MSG | ||
FASTFLOAT_INCLUDE_DIR | ||
) | ||
|
||
mark_as_advanced(FASTFLOAT_INCLUDE_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters