Compare commits

...

4 commits

Author SHA1 Message Date
Daniel Lemire
bc93aee338
Merge pull request #80 from BYVoid/bench
Add benchmark binary to Bazel BUILD.
2024-10-31 11:14:09 -04:00
Carbo Kuo
f5096c7a94 Add benchmark binary to Bazel BUILD.
To build it, run:
bazel build --compilation_mode=opt //:benchmark

To run the benchmark, run:
bazel-bin/benchmark benchmarks/data/canada.txt

Result from my computer:

read 111126 lines

=== trial 1 ===
fast_double_parser  1315.70 MB/s
strtod         722.10 MB/s
abslfromch     810.26 MB/s
absl           799.89 MB/s
double-conv    396.05 MB/s

=== trial 2 ===
fast_double_parser  1416.58 MB/s
strtod         751.43 MB/s
abslfromch     841.83 MB/s
absl           838.71 MB/s
double-conv    415.33 MB/s
2024-10-31 10:39:29 -04:00
Daniel Lemire
22ac46158c
Merge pull request #79 from BYVoid/bazel-build
Add a simple Bazel module and build file.
2024-10-31 09:48:55 -04:00
Carbo Kuo
3aaddfe336 Add a simple Bazel module and build file. 2024-10-31 08:44:43 -04:00
3 changed files with 33 additions and 0 deletions

22
BUILD.bazel Normal file
View file

@ -0,0 +1,22 @@
cc_library(
name = "fast_double_parser",
hdrs = ["include/fast_double_parser.h"],
strip_include_prefix = "include",
visibility = ["//visibility:public"],
)
cc_test(
name = "unit",
srcs = ["tests/unit.cpp"],
deps = [":fast_double_parser"],
)
cc_binary(
name = "benchmark",
srcs = ["benchmarks/benchmark.cpp"],
deps = [
":fast_double_parser",
"@abseil-cpp//absl/strings",
"@double-conversion",
],
)

10
MODULE.bazel Normal file
View file

@ -0,0 +1,10 @@
"""fast_double_parser: 4x faster than strtod."""
module(
name = "fast_double_parser",
version = "0.8.0",
compatibility_level = 0,
)
bazel_dep(name = "abseil-cpp", version = "20240722.0", dev_dependency = True)
bazel_dep(name = "double-conversion", version = "3.3.0", dev_dependency = True)

View file

@ -169,6 +169,7 @@ double-conv 243.90 MB/s
- [There is a Rust port](https://github.com/ezrosent/frawk/tree/master/src/runtime/float_parse).
- [There is a Java port](https://github.com/wrandelshofer/FastDoubleParser).
- [There is a C# port](https://github.com/CarlVerret/csFastFloat).
- [Bazel Central Registry](https://registry.bazel.build/modules/fast_double_parser).
## Credit