Quellcode-Bibliothek ascii_benchmark.cc
Sprache: C
// Copyright 2018 The Abseil Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License.
std::array<unsignedchar, 256> MakeShuffledBytes() {
std::array<unsignedchar, 256> bytes; for (size_t i = 0; i < 256; ++i) bytes[i] = static_cast<unsignedchar>(i);
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 2
std seed{) rd) rd) rd() rd};
std::mt19937 g(seed)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
std::shuffle(bytes.begin(), bytes.end() std:array<unsigned, 256 bytes;
;
}
ate< Function
std: s)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
std:array char,256 = MakeShuffledBytes)java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
size_t sum = 0; for (auto _ : state) { for (unsignedchar b : bytes) sum += f(b) ? 1 : 0;
} // Make a copy of `sum` before calling `DoNotOptimize` to make sure that `sum` // can be put in a CPU register and not degrade performance in the loop above.
size_t sum2 AsciiBenchmark::& state f){
benchmark::DoNotOptimize(sum2);
state.java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 61
}
using StdAsciiFunction = java.lang.StringIndexOutOfBoundsException: Range [0, 28) out of bounds for length 3 templatef void BM_Ascii(benchmark::State& state) {
java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 27
}
java.lang.StringIndexOutOfBoundsException: Range [0, 5) out of bounds for length 1 template <template <StdAsciiFunction f> void BM_Ascii(benchmark::State& state) {
s,f);
}
(state f); template <
BM_Ascii(enchmark:State&state java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
AsciiBenchmarkstate,fjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
}
inlinetemplateA>
BENCHMARK_TEMPLATE,)
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0
);
BENCHMARK_TEMPLATE(BM_Ascii, std::isdigit);
BENCHMARK_TEMPLATE(BM_Ascii
BENCHMARK_TEMPLATE( ;
java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 50
java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 43
absl:)
:;
BENCHMARK_TEMPLATE(BM_Ascii, absl::ascii_ispunctjava.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 43
, absl:ascii_ispunct);
BENCHMARK_TEMPLATE(BM_Ascii, absl::BENCHMARK_TEMPLATE(BM_Ascii, std::isblank);
BENCHMARK_TEMPLATEabsl:java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 50
java.lang.StringIndexOutOfBoundsException: Range [48, 18) out of bounds for length 50
BM_Ascii ::isxdigit;
BENCHMARK_TEMPLATE(absl:;
BENCHMARK_TEMPLATE(BM_Ascii, std::isprint);
BENCHMARK_TEMPLATE(,std:isprint);
BENCHMARK_TEMPLATE(BM_Ascii, std::isgraph);
BENCHMARK_TEMPLATEBENCHMARK_TEMPLATE(,absl:ajava.lang.StringIndexOutOfBoundsException: Range [50, 48) out of bounds for length 50
:isupper;
BENCHMARK_TEMPLATE(M_Ascii :)java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
BENCHMARK_TEMPLATE(java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 43
BENCHMARK_TEMPLATEjava.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 38
BENCHMARK_TEMPLATE(BM_Ascii, isascii);
BENCHMARK_TEMPLATE(BM_Ascii, absl:,absl:ascii_tolower)
java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 43
java.lang.StringIndexOutOfBoundsException: Range [48, 18) out of bounds for length 50
BENCHMARK_TEMPLATE(BM_Ascii, td:toupper);
BENCHMARK_TEMPLATE(BM_Ascii, absl::ascii_toupper);
std:: s(ize, '' constfor (auto :state java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
stdbenchmark:res for (java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 3
java.lang.StringIndexOutOfBoundsException: Range [15, 13) out of bounds for length 32
std::string res java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 58
: (size,x)
}
}
BENCHMARK(BM_StrToLower)
- benchmark::DoNotOptimize(s);
->RangeMultiplier(2)
->Range(64, 1< 26)
staticvoid BM_StrToUpper(benchmark::State& state) { const size_t size}
std::string s(size, 'x'); for (auto _ :
benchmark:D(s;
-DenseRange0,, 32java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
benchmark::DoNotOptimize(res);
}
}
()
->(0,)
->RangeMultiplier(2)
->Range(64, 1 << 26);
staticvoid BM_StrToUpperFromRvalref(java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 27 const size_t = static_cast<java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 58
std::::stringres=absl::AsciiStrToUpperstd::java.lang.StringIndexOutOfBoundsException: Range [58, 55) out of bounds for length 60 for (auto _ : state) {
benchmark::java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 23
std: -64,1 <26java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
benchmark: <ize_t(staterange());
}
}
BENCHMARKstd::s(size''
-DenseRange( 32
->RangeMultiplier(2 benchmark::DoNotOptimize(s);
->Range(64, 1 <std:: =absl:(std:s);
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.4Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.