From b44f9217830368d7865e8f1139784833116cb122 Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Sun, 17 Mar 2024 12:05:27 +0100 Subject: [PATCH 1/2] [benchamrk] Fixes Emoji codepoint in benchmarkWithOffset test Signed-off-by: Christian Parpart --- src/libunicode/benchmark.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libunicode/benchmark.cpp b/src/libunicode/benchmark.cpp index fdea09a..33fc775 100644 --- a/src/libunicode/benchmark.cpp +++ b/src/libunicode/benchmark.cpp @@ -21,7 +21,7 @@ static void benchmarkWithLength(benchmark::State& state) template static void benchmarkWithOffset(benchmark::State& state) { - auto TestText = std::string(L, 'a') + "\u0001F600" + std::string(1000, 'a'); + auto TestText = std::string(L, 'a') + "\U0001F600" + std::string(1000, 'a'); for (auto _: state) { benchmark::DoNotOptimize(unicode::detail::scan_for_text_ascii(TestText, L + 10)); From a5cb20f60199e4971bc6a27e4ab31654a15cab4f Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Sun, 17 Mar 2024 12:06:16 +0100 Subject: [PATCH 2/2] [benchmark] Rename parameter state to benchmarkState to be more obvious (prep-work for the future :) ) Signed-off-by: Christian Parpart --- src/libunicode/benchmark.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libunicode/benchmark.cpp b/src/libunicode/benchmark.cpp index 33fc775..f80e18a 100644 --- a/src/libunicode/benchmark.cpp +++ b/src/libunicode/benchmark.cpp @@ -9,20 +9,20 @@ using std::string_view; template -static void benchmarkWithLength(benchmark::State& state) +static void benchmarkWithLength(benchmark::State& benchmarkState) { auto TestText = std::string(L, 'a') + "\u00A9"; - for (auto _: state) + for (auto _: benchmarkState) { benchmark::DoNotOptimize(unicode::detail::scan_for_text_ascii(TestText, L + 10)); } } template -static void benchmarkWithOffset(benchmark::State& state) +static void benchmarkWithOffset(benchmark::State& benchmarkState) { auto TestText = std::string(L, 'a') + "\U0001F600" + std::string(1000, 'a'); - for (auto _: state) + for (auto _: benchmarkState) { benchmark::DoNotOptimize(unicode::detail::scan_for_text_ascii(TestText, L + 10)); }