proxygen
SettingsBenchmarks.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2018-present Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #include <folly/Benchmark.h>
18 #include <folly/init/Init.h>
19 
20 /*
21 ============================================================================
22 folly/experimental/settings/test/SettingsBenchmarks.cpprelative time/iter
23 iters/s
24 ============================================================================
25 settings_get_bench 1.73ns 577.36M
26 ============================================================================
27 */
28 
29 FOLLY_SETTING_DEFINE(follytest, benchmarked, int, 100, "desc");
30 
31 BENCHMARK(settings_get_bench, iters) {
32  for (unsigned int i = 0; i < iters; ++i) {
33  auto value = *FOLLY_SETTING(follytest, benchmarked);
35  }
36 }
37 
38 int main(int argc, char** argv) {
39  folly::init(&argc, &argv);
41 
42  return 0;
43 }
void runBenchmarks()
Definition: Benchmark.cpp:456
void init(int *argc, char ***argv, bool removeFlags)
Definition: Init.cpp:34
char ** argv
BENCHMARK(settings_get_bench, iters)
static const char *const value
Definition: Conv.cpp:50
FOLLY_SETTING_DEFINE(follytest, benchmarked, int, 100,"desc")
#define FOLLY_SETTING(_project, _name)
Definition: Settings.h:192
int main(int argc, char **argv)
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258