aboutsummaryrefslogtreecommitdiffstats
path: root/util/string/benchmark/ascii
diff options
context:
space:
mode:
authorMikhail Borisov <borisov.mikhail@gmail.com>2022-02-10 16:45:39 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:39 +0300
commita6a92afe03e02795227d2641b49819b687f088f8 (patch)
treef6984a1d27d5a7ec88a6fdd6e20cd5b7693b6ece /util/string/benchmark/ascii
parentc6dc8b8bd530985bc4cce0137e9a5de32f1087cb (diff)
downloadydb-a6a92afe03e02795227d2641b49819b687f088f8.tar.gz
Restoring authorship annotation for Mikhail Borisov <borisov.mikhail@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'util/string/benchmark/ascii')
-rw-r--r--util/string/benchmark/ascii/main.cpp70
1 files changed, 35 insertions, 35 deletions
diff --git a/util/string/benchmark/ascii/main.cpp b/util/string/benchmark/ascii/main.cpp
index 673047025d..49ad13228d 100644
--- a/util/string/benchmark/ascii/main.cpp
+++ b/util/string/benchmark/ascii/main.cpp
@@ -17,20 +17,20 @@ namespace {
return Get((ui8)x) ? x + ('a' - 'A') : x;
}
};
-
- struct TToLowerLookup {
- char Table[256];
-
- TToLowerLookup() {
- for (size_t i : xrange(256)) {
- Table[i] = AsciiToLower(i);
- }
- }
-
- char ToLower(char x) const noexcept {
- return Table[(ui8)x];
- }
- };
+
+ struct TToLowerLookup {
+ char Table[256];
+
+ TToLowerLookup() {
+ for (size_t i : xrange(256)) {
+ Table[i] = AsciiToLower(i);
+ }
+ }
+
+ char ToLower(char x) const noexcept {
+ return Table[(ui8)x];
+ }
+ };
}
static inline char FastAsciiToLower(char c) {
@@ -91,27 +91,27 @@ Y_CPU_BENCHMARK(BitMapAsciiToLower, iface) {
}
}
-Y_CPU_BENCHMARK(LookupAsciiToLower, iface) {
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
-
- for (int j = 0; j < 256; ++j) {
- Y_DO_NOT_OPTIMIZE_AWAY(Singleton<TToLowerLookup>()->ToLower(j));
- }
- }
-}
-
-Y_CPU_BENCHMARK(LookupAsciiToLowerNoSingleton, iface) {
- TToLowerLookup lookup;
- for (const auto i : xrange(iface.Iterations())) {
- Y_UNUSED(i);
-
- for (int j = 0; j < 256; ++j) {
- Y_DO_NOT_OPTIMIZE_AWAY(lookup.ToLower(j));
- }
- }
-}
-
+Y_CPU_BENCHMARK(LookupAsciiToLower, iface) {
+ for (const auto i : xrange(iface.Iterations())) {
+ Y_UNUSED(i);
+
+ for (int j = 0; j < 256; ++j) {
+ Y_DO_NOT_OPTIMIZE_AWAY(Singleton<TToLowerLookup>()->ToLower(j));
+ }
+ }
+}
+
+Y_CPU_BENCHMARK(LookupAsciiToLowerNoSingleton, iface) {
+ TToLowerLookup lookup;
+ for (const auto i : xrange(iface.Iterations())) {
+ Y_UNUSED(i);
+
+ for (int j = 0; j < 256; ++j) {
+ Y_DO_NOT_OPTIMIZE_AWAY(lookup.ToLower(j));
+ }
+ }
+}
+
Y_CPU_BENCHMARK(tolower, iface) {
for (const auto i : xrange(iface.Iterations())) {
Y_UNUSED(i);