Skip to content

Commit

Permalink
Add benchmark binary to Bazel BUILD.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
BYVoid committed Oct 31, 2024
1 parent 22ac461 commit f5096c7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,13 @@ cc_test(
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",
],
)
3 changes: 3 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ module(
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)

0 comments on commit f5096c7

Please sign in to comment.