Skip to content

Commit

Permalink
Update benchmark results
Browse files Browse the repository at this point in the history
  • Loading branch information
eliaskosunen committed Jan 9, 2024
1 parent 629c3c5 commit 24c0b3e
Show file tree
Hide file tree
Showing 12 changed files with 274 additions and 124 deletions.
290 changes: 170 additions & 120 deletions README.md

Large diffs are not rendered by default.

Binary file modified benchmark/binarysize/graph-debug.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified benchmark/binarysize/graph-minsizerel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified benchmark/binarysize/graph-release.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions benchmark/runtime/float/repeated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include <charconv>
#endif

#include <fast_float/fast_float.h>

template <typename Float>
static void scan_float_repeated_scn(benchmark::State& state)
{
Expand Down Expand Up @@ -186,3 +188,26 @@ BENCHMARK_TEMPLATE(scan_float_repeated_charconv, double);
BENCHMARK_TEMPLATE(scan_float_repeated_charconv, long double);

#endif // SCN_HAS_FLOAT_CHARCONV

template <typename Float>
static void scan_float_repeated_fastfloat(benchmark::State& state)
{
repeated_state<Float> s{get_float_string<Float>()};

for (auto _ : state) {
Float f{};
s.skip_classic_ascii_space();

auto ret = fast_float::from_chars(s.view().begin(), s.view().end(), f);
if (ret.ec != std::errc{}) {
state.SkipWithError("Scan error");
break;
}
s.it = ret.ptr;
s.push(f);
}
state.SetBytesProcessed(s.get_bytes_processed(state));
}
BENCHMARK_TEMPLATE(scan_float_repeated_fastfloat, float);
BENCHMARK_TEMPLATE(scan_float_repeated_fastfloat, double);
BENCHMARK_TEMPLATE(scan_float_repeated_fastfloat, long double);
25 changes: 25 additions & 0 deletions benchmark/runtime/float/single.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include <charconv>
#endif

#include <fast_float/fast_float.h>

template <typename Float>
static void scan_float_single_scn(benchmark::State& state)
{
Expand Down Expand Up @@ -161,3 +163,26 @@ BENCHMARK_TEMPLATE(scan_float_single_charconv, double);
BENCHMARK_TEMPLATE(scan_float_single_charconv, long double);

#endif // SCN_HAS_FLOAT_CHARCONV

template <typename Float>
static void scan_float_single_fastfloat(benchmark::State& state)
{
single_state<Float> s{get_float_list<Float>()};

for (auto _ : state) {
s.reset_if_necessary();

Float f{};
auto ret = fast_float::from_chars(s.it->data(),
s.it->data() + s.it->size(), f);
if (ret.ec != std::errc{}) {
state.SkipWithError("Benchmark errored");
break;
}
s.push(f);
}
state.SetBytesProcessed(s.get_bytes_processed(state));
}
BENCHMARK_TEMPLATE(scan_float_single_fastfloat, float);
BENCHMARK_TEMPLATE(scan_float_single_fastfloat, double);
BENCHMARK_TEMPLATE(scan_float_single_fastfloat, long double);
25 changes: 25 additions & 0 deletions benchmark/runtime/integer/repeated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include <charconv>
#endif

#include <fast_float/fast_float.h>

template <typename Int>
static void scan_int_repeated_scn(benchmark::State& state)
{
Expand Down Expand Up @@ -246,3 +248,26 @@ BENCHMARK_TEMPLATE(scan_int_repeated_charconv, long long);
BENCHMARK_TEMPLATE(scan_int_repeated_charconv, unsigned);

#endif // SCN_HAS_INTEGER_CHARCONV

template <typename Int>
static void scan_int_repeated_fastfloat(benchmark::State& state)
{
repeated_state<Int> s{get_integer_string<Int>()};

for (auto _ : state) {
Int i{};
s.skip_classic_ascii_space();

auto ret = fast_float::from_chars(s.view().begin(), s.view().end(), i);
if (ret.ec != std::errc{}) {
state.SkipWithError("Scan error");
break;
}
s.it = ret.ptr;
s.push(i);
}
state.SetBytesProcessed(s.get_bytes_processed(state));
}
BENCHMARK_TEMPLATE(scan_int_repeated_fastfloat, int);
BENCHMARK_TEMPLATE(scan_int_repeated_fastfloat, long long);
BENCHMARK_TEMPLATE(scan_int_repeated_fastfloat, unsigned);
25 changes: 25 additions & 0 deletions benchmark/runtime/integer/single.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include <charconv>
#endif

#include <fast_float/fast_float.h>

template <typename Int>
static void scan_int_single_scn(benchmark::State& state)
{
Expand Down Expand Up @@ -222,3 +224,26 @@ BENCHMARK_TEMPLATE(scan_int_single_charconv, long long);
BENCHMARK_TEMPLATE(scan_int_single_charconv, unsigned);

#endif // SCN_HAS_INTEGER_CHARCONV

template <typename Int>
static void scan_int_single_fastfloat(benchmark::State& state)
{
single_state<Int> s{get_integer_list<Int>()};

for (auto _ : state) {
s.reset_if_necessary();

Int i{};
auto ret = fast_float::from_chars(s.it->data(),
s.it->data() + s.it->size(), i);
if (ret.ec != std::errc{}) {
state.SkipWithError("Benchmark errored");
break;
}
s.push(i);
}
state.SetBytesProcessed(s.get_bytes_processed(state));
}
BENCHMARK_TEMPLATE(scan_int_single_fastfloat, int);
BENCHMARK_TEMPLATE(scan_int_single_fastfloat, long long);
BENCHMARK_TEMPLATE(scan_int_single_fastfloat, unsigned);
Binary file modified benchmark/runtime/results/float.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified benchmark/runtime/results/int.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified benchmark/runtime/results/string.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ endif ()
# we don't want to include tests of dependencies, so we need to do some manual work

if (SCN_USE_EXTERNAL_SIMDUTF)
find_package(simdutf 4.0.5 CONFIG REQUIRED)
find_package(simdutf 4.0.0 CONFIG REQUIRED)
else ()
FetchContent_Declare(
simdutf
GIT_REPOSITORY https://github.com/simdutf/simdutf.git
GIT_TAG v4.0.5
GIT_TAG v4.0.8
GIT_SHALLOW TRUE
)

Expand All @@ -90,12 +90,12 @@ endif ()
# fast_float

if (SCN_USE_EXTERNAL_FAST_FLOAT)
find_package(FastFloat 5.3.0 CONFIG REQUIRED)
find_package(FastFloat 6.0.0 CONFIG REQUIRED)
else ()
FetchContent_Declare(
fast_float
GIT_REPOSITORY https://github.com/fastfloat/fast_float.git
GIT_TAG v5.3.0
GIT_TAG v6.0.0
GIT_SHALLOW TRUE
)

Expand Down

0 comments on commit 24c0b3e

Please sign in to comment.