Skip to content
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

feat: Integration with fast_float #1170

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions deps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ distclean:
-(cd jemalloc && [ -f Makefile ] && $(MAKE) distclean) > /dev/null || true
-(cd hdr_histogram && $(MAKE) clean) > /dev/null || true
-(cd fpconv && $(MAKE) clean) > /dev/null || true
-(cd fast_float && $(MAKE) clean) > /dev/null || true
-(rm -f .make-*)

.PHONY: distclean
Expand Down Expand Up @@ -74,6 +75,12 @@ fpconv: .make-prerequisites

.PHONY: fpconv

fast_float: .make-prerequisites
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
cd fast_float && $(MAKE)

.PHONY: fast_float

ifeq ($(uname_S),SunOS)
# Make isinf() available
LUA_CFLAGS= -D__C99FEATURES__=1
Expand Down
23 changes: 23 additions & 0 deletions deps/fast_float/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Author: Roshan Swain <[email protected]>

CXX?=g++
CXXFLAGS=-std=c++11 -O3 -fPIC
AR=ar
ARFLAGS=rcs

SOURCES=fast_float_strtod.cpp
OBJECTS=$(SOURCES:.cpp=.o)
TARGET=libfast_float.a

all: $(TARGET)

$(TARGET): $(OBJECTS)
$(AR) $(ARFLAGS) $@ $^

%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@

clean:
rm -f $(OBJECTS) $(TARGET)

.PHONY: all clean
30 changes: 30 additions & 0 deletions deps/fast_float/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 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.

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):

```C++
from_chars_result from_chars(const char* first, const char* last, float& value, ...);
from_chars_result from_chars(const char* first, const char* last, double& value, ...);
```

## INTEGRATION

1. `fast_float_strtod` is a wrapper around the `from_chars` function.

## RESOURCES

1. fast_float: https://github.com/fastfloat/fast_float


...REMOVE THIS LATER...

- [x] Create the wrapper.
- [] Compile it.
- [] Replace it with strtod.
- [] Benchmark it.
- [] Run it on different platforms.

Loading
Loading