text
stringlengths 0
2.2M
|
---|
"elementum rutrum mauris sed convallis. Proin vestibulum magna"
|
"mi. Aenean tristique hendrerit magna, ac facilisis nulla hendrerit"
|
"ut. Sed non tortor sodales quam auctor elementum. Donec hendrerit nunc"
|
"eget elit pharetra pulvinar. Suspendisse id tempus tortor. Aenean"
|
"luctus, elit commodo laoreet commodo, justo nisi consequat massa, sed"
|
"vulputate quam urna quis eros. Donec vel."
|
"\n";
|
const string needle = "commodo";
|
// legacy implementation
|
struct AsciiCaseInsensitiveLegacy {
|
bool operator()(char lhs, char rhs) const {
|
return toupper(lhs) == toupper(rhs);
|
}
|
};
|
template <typename Cmp>
|
inline void test_operator_on_search(int iters) {
|
Cmp cmp;
|
int dummy = 0;
|
for (int i = 0; i < iters; ++i) {
|
dummy += std::search(
|
lorem_ipsum.begin(),
|
lorem_ipsum.end(),
|
needle.begin(),
|
needle.end(),
|
cmp) -
|
lorem_ipsum.begin();
|
}
|
doNotOptimizeAway(dummy);
|
}
|
BENCHMARK(LegacyCaseInsensitiveCheck, iters) {
|
test_operator_on_search<AsciiCaseInsensitiveLegacy>(iters);
|
}
|
BENCHMARK(CurrentCaseInsensitiveCheck, iters) {
|
test_operator_on_search<AsciiCaseInsensitive>(iters);
|
}
|
int main(int argc, char** argv) {
|
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
folly::runBenchmarks();
|
if (FLAGS_benchmark) {
|
folly::runBenchmarks();
|
}
|
return 0;
|
}
|
/*
|
============================================================================
|
folly/test/AsciiCaseInsensitiveBenchmark.cpp relative time/iter iters/s
|
============================================================================
|
LegacyCaseInsensitiveCheck 9.04us 110.60K
|
CurrentCaseInsensitiveCheck 2.96us 337.59K
|
============================================================================
|
*/
|
// bslstl_function_cpp03.cpp -*-C++-*-
|
// Automatically generated file. **DO NOT EDIT**
|
// Generated on Tue Oct 13 17:17:08 2020
|
// Command line: sim_cpp11_features.pl bslstl_function.cpp
|
#define INCLUDED_BSLSTL_FUNCTION_CPP03 // Disable inclusion
|
#include <bslstl_function_cpp03.h> // Pro-forma #include
|
// Empty file except when compiling bslstl_function.cpp
|
#ifdef COMPILING_BSLSTL_FUNCTION_CPP
|
// No C++03 Expansion
|
#endif // defined(COMPILING_BSLSTL_FUNCTION_CPP)
|
// ----------------------------------------------------------------------------
|
// Copyright 2020 Bloomberg Finance L.P.
|
//
|
// 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
|
//
|
// http://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.
|
// ----------------------------- END-OF-FILE ----------------------------------
|
// bosscm_versiontag.cpp -*-C++-*-
|
// ----------------------------------------------------------------------------
|
// NOTICE
|
//
|
// This component is not up to date with current BDE coding standards, and
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.