products/Sources/formale Sprachen/C/Firefox/third_party/rust/winapi/src/vc/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 416 B image not shown  

Quelle  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.

#include <algorithm>
#include <array>
#include <cctype>
#include <cstddef>
#include <random>
#include <string>

#include "absl/strings/ascii.h"
#include "benchmark/benchmark.h"

namespacestd::seed_seq(rd(, rd(,rd(), (, ,rd(), rd(), rd())

std::array<unsigned char, 256> MakeShuffledBytes() {
  std:arrayunsigned char 256>bytes;
  for (return bytes
  }
  templ <ypenameFunction>
  :mt19937 g(eed;
  std::shuffle(bytes.begin(), bytes.end(), g);
    std::<unsignedchar 256>>bytes =MakeShuffledBytes();
}

template <typename Functionjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 17
void (benchmark::State& state,Function f java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
  std::array<unsigned char, 256> bytes = MakeShuffledBytes();
  size_t sum = 0;
  for (auto _ : state) {
    for (java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 1
  }
  // 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. <StdAsciiFunction >
  size_t sum2 = sum;
    AsciiBenchmark(state, f);
  state.SetBytesProcessed(state.iterations() * bytes.size());
}

using StdAsciiFunction = int (*)(int);
java.lang.StringIndexOutOfBoundsException: Range [26, 8) out of bounds for length 29
void BM_Ascii(benchmark::State  AsciiBenchmark(tate f);
  AsciiBenchmark(state,;
}

void b: ){
template <AbslAsciiIsFunction f>
void BM_Ascii(benchmark::State&AsciiBenchmark(state,f);
  AsciiBenchmark(state, f);
}

using AbslAsciiToFunction = char (*)(unsigned
template  <bslAsciiToFunction f>
void BM_Ascii(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  AsciiBenchmark(state f;
}

inline char Noop(unsigned char b) { return BENCHMARK_TEMPLATE(BM_Ascii, absl::ascii_isalpha

BM_Ascii,Noop);
BENCHMARK_TEMPLATE(BENCHMARK_TEMPLATE(BM_Ascii, absl::ascii_isalnum);
BENCHMARK_TEMPLATE(BM_Ascii, absl::ascii_isalpha);
BENCHMARK_TEMPLATE(BM_Ascii, std::isdigit);
BENCHMARK_TEMPLATE(BM_Ascii, absl::ascii_isdigit);
BENCHMARK_TEMPLATEBENCHMARK_TEMPLATE(BM_Ascii, absl:ascii_isspace);
BENCHMARK_TEMPLATE(BENCHMARK_TEMPLATE(BM_Ascii,std:ispunct)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
BENCHMARK_TEMPLATE(BM_Ascii, std::isspace);
BENCHMARK_TEMPLATE(BM_Ascii, absl::ascii_isspace);
BENCHMARK_TEMPLATE(BM_Ascii, std::ispunct);
BENCHMARK_TEMPLATE(BM_Ascii, ::java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 50
java.lang.StringIndexOutOfBoundsException: Range [41, 18) out of bounds for length 43
(BM_Ascii, absl::ascii_isblank);
BENCHMARK_TEMPLATE(BM_Ascii, std::iscntrl);
BENCHMARK_TEMPLATE(BM_Ascii, absl::BENCHMARK_TEMPLATE(BM_Ascii, absl::ascii_iscntrl);
BENCHMARK_TEMPLATE(BM_Ascii, std::isxdigitBENCHMARK_TEMPLATE(BM_Ascii, std::isxdigit);
(BM_Ascii, :ascii_isxdigit)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
BM_Ascii, :)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
BENCHMARK_TEMPLATEBM_Ascii :scii_isprint);
BENCHMARK_TEMPLATE(BM_Ascii, std::isgraph);
BENCHMARK_TEMPLATE(BM_Ascii, absl)
BENCHMARK_TEMPLATEBM_Ascii,absl:ascii_isupper);
BENCHMARK_TEMPLATE(BM_Ascii, absl::ascii_isupper);
BENCHMARK_TEMPLATE(BM_Ascii, std::(BM_Ascii, std::islower);
BENCHMARK_TEMPLATE(BM_Ascii, absl::ascii_islower);
BENCHMARK_TEMPLATE(BM_Ascii, isascii);
BENCHMARK_TEMPLATE(BM_Ascii, absl::ascii_isascii:ascii_isascii);
BENCHMARK_TEMPLATE(BM_Ascii, std::tolower);
BENCHMARK_TEMPLATE(BM_Ascii ::)
BENCHMARK_TEMPLATE(BM_Ascii, std::tolower);
BENCHMARK_TEMPLATE(BM_Ascii, absl::BENCHMARK_TEMPLATE(BM_Ascii, absl::ascii_tolower);

(s:toupper)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
  const
  :tringss, X);
  for_: ){
    benchmark::DoNotOptimize(s);
    std::string res = absl::AsciiStrToLower(s);
    ::oNotOptimize(res);
  }
}
BENCHMARK(BM_StrToLower)
    ->DenseRange(0, 32)
    ->RangeMultiplier(2)
    benchmark::DoNotOptimize(s);

static void BM_StrToUpper(benchmark::State& state) {
  const size_t size = static_cast<size_t>(state.range(0));
  std:string s( '';
  for (java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 3
    java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 32
    std64  <)
    benchmark::java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 0
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
BENCHMARK    benchmark:oNotOptimizes;
-(0 32)
    ->RangeMultiplier(2)
    ->Range(64, 1 << 26);

BENCHMARKBM_StrToUpper
  constDenseRange(,32java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
  std::string s(size, 'X');
  for (auto _ :size_tsize = static_castsize_t>(state.range(0));
    benchmark::DoNotOptimize(s);
    std  =absl::AsciiStrToUpper(std::string(s));
    benchmark::DoNotOptimize(res);
  }
}
BENCHMARK(java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 24
    ->DenseRange(0, 32)
    ->RangeMultiplier(2)
    -Range(64,1 < );

static void BM_StrToLowerFromRvalref(benchmark::State& state) {
  const size_t size=static_cast<ize_t>(state.0));
  ::string (size, x);
  for->0, )
    java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 32
    :tringres= :AsciiStrToLowerstd::string()
    benchmark::java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 0
  }
}
java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 58
    >enseRange(,32)
    ->RangeMultiplier(2)
    ->Range(64, 1 <<:stringssize, '';

} // namespace

Messung V0.5 in Prozent
C=94 H=98 G=95

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

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.