-
Notifications
You must be signed in to change notification settings - Fork 652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrating fast_float with Valkey to replace strtod invocation #1260
Open
parthpatel
wants to merge
48
commits into
valkey-io:unstable
Choose a base branch
from
parthpatel:unstable
base: unstable
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4,183
−25
Open
Changes from 30 commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
42c1d0c
feat (deps): adds fast_float library and a c wrapper for from_chars f…
swaingotnochill d25e29b
Changes to complete the integration of fast_float into Redis codebase.
parthpatel 939a766
Fixing code-style issue due to empty space
parthpatel c2d6ff6
Adding 32-bit c++ libraries to library path to fix 32-bit compilation…
parthpatel 597af83
Trying another approach to fix the CI workflows by installing require…
parthpatel 8d07687
Adding -v to linker for more output to debug issues.
parthpatel 4f03150
32-bit stdc++ libraries are in a different folder, so needed to speci…
parthpatel e9e5209
Also fixing the library to be non-cross version of libstdc++
parthpatel d7c72cf
This attempt uses the cross-compile libraries provided by ubuntu for …
parthpatel d69ec21
Forwarding CFLAGS and LDFLAGS to fast_float Makefile to honor 32 bit …
parthpatel 50abf50
Putting LDFLAGS in quotes to escape spaces and /
parthpatel c0ec94f
More fixes
parthpatel 6900219
Removing unnecessary library path declaration
parthpatel 63a2f42
Including all the headers from fast_float project under a directory f…
parthpatel ba9c99a
Adding back the code to set errno when conversion fails but reducing …
parthpatel 1471233
Update deps/fast_float/Makefile
parthpatel 87654b0
Update src/Makefile
parthpatel 9f1b352
Replacing strtod in util.c file as well.
parthpatel 3048954
Made fast_float an optional library for build. Turning it off by defa…
parthpatel 0941aec
Cleaning up README and adding license information
parthpatel a92d636
Fixing formatting issues as per Clang-format output
parthpatel adb46cd
Fixing more formatting issues
parthpatel ce38546
Move CXX to c++ instead of g++
parthpatel ac3af73
Refactoring to simplify things
parthpatel ad0f785
Moving the fast_float integration code into src/fast_float
parthpatel ad93430
Consolidating all ifdefs into fast_float integration header by using …
parthpatel 8357b03
Forgot to remove ifdefs around header files. This commit fixes it.
parthpatel f7efd98
Taking care of warnings
parthpatel 87f979f
Fixing more CI related issues. Making build work with both fast_float…
parthpatel 5d3268f
Fixed formatting issues from clang-format
parthpatel 5bb9606
Merge branch 'valkey-io:unstable' into unstable
parthpatel 05e12e9
Update src/Makefile
parthpatel d66bd37
Update src/fast_float/fast_float_strtod.h
parthpatel 7280cb3
Consolidating all fast_float code into a single if block inside Makefile
parthpatel c99a80c
Combining Makefile and moving unit test to src/unit directory.
parthpatel ee1d369
Fixed unit tests and build
parthpatel f42e9c6
Add QUIET_CXX definition in Makefile.
parthpatel 5be910d
Moving the valkey_strtod.* files back to deps folder.
parthpatel acb10e6
Merge branch 'valkey-io:unstable' into unstable
parthpatel 8c1ab28
Update deps/Makefile
madolson 2050389
Update deps/README.md
parthpatel 836bfdb
Fixing Makefiles and CI workflows
parthpatel 9450ebf
Fixing a few naming and compilation issues.
parthpatel 9d681ac
Merge branch 'valkey-io:unstable' into unstable
parthpatel a69568f
Applying yamlfmt suggestions
parthpatel 2cb45b5
Fixing 32-bit build by setting appropriate variables in fast_float_c_…
parthpatel 129fdbf
Fixing Makefile related issues failing CI
parthpatel 43696b5
Remove some unnecessary imports and use SPDX for license
madolson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -6,6 +6,7 @@ should be provided by the operating system. | |||||||
* **linenoise** is a readline replacement. It is developed by the same authors of Valkey but is managed as a separated project and updated as needed. | ||||||||
* **lua** is Lua 5.1 with minor changes for security and additional libraries. | ||||||||
* **hdr_histogram** Used for per-command latency tracking histograms. | ||||||||
* **fast_float** is a replacement for strtod to convert strings to floats efficiently. | ||||||||
|
||||||||
How to upgrade the above dependencies | ||||||||
=== | ||||||||
|
@@ -105,3 +106,16 @@ We use a customized version based on master branch commit e4448cf6d1cd08fff51981 | |||||||
2. Copy updated files from newer version onto files in /hdr_histogram. | ||||||||
3. Apply the changes from 1 above to the updated files. | ||||||||
|
||||||||
fast_float | ||||||||
--- | ||||||||
The fast_float library provides fast header-only implementations for the C++ from_chars | ||||||||
functions for `float` and `double` types as well as integer types. These functions convert ASCII strings representing decimal values (e.g., `1.3e10`) into binary types. We provide exact rounding (including | ||||||||
round to even). In our experience, these `fast_float` functions many times faster than comparable number-parsing functions from existing C++ standard libraries. | ||||||||
parthpatel marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
|
||||||||
Specifically, `fast_float` provides the following two functions to parse floating-point numbers with a C++17-like syntax (the library itself only requires C++11): | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't seem relevant. But what I think is very important to mention is the distinction between the external dependency and our integration code. That was the source of this long debate.
Suggested change
|
||||||||
|
||||||||
To upgrade the library, | ||||||||
1. Check out https://github.com/fastfloat/fast_float/tree/main | ||||||||
2. cd fast_float | ||||||||
3. Invoke "python3 ./script/amalgamate.py --output fast_float.h" | ||||||||
4. Copy fast_float.h file to "deps/fast_float/". |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to add this C++ stuff in jobs where we don't use
USE_FAST_FLOAT=yes
? It looks like a mistake.I don't see that we use
USE_FAST_FLOAT=yes
anywhere in the CI job. I think we should use it in at least one of the CI test jobs. I suggest we use it intest-ubuntu-latest
, or maybe in most of the jobs but not all.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is old commit. I will add a separate job.